Source Code Cross Referenced for Gripper.java in  » Swing-Library » jide-common » com » jidesoft » swing » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Swing Library » jide common » com.jidesoft.swing 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * @(#) Gripper.java
003:         * Last modified date: 2/9/2005
004:         *
005:         * Copyright 2002 - 2005 JIDE Software Inc. All rights reserved.
006:         */
007:
008:        package com.jidesoft.swing;
009:
010:        import com.jidesoft.plaf.GripperUI;
011:        import com.jidesoft.plaf.LookAndFeelFactory;
012:        import com.jidesoft.plaf.UIDefaultsLookup;
013:
014:        import javax.swing.*;
015:        import javax.swing.plaf.UIResource;
016:        import java.awt.*;
017:
018:        /**
019:         * Gripper is a component that you can drag. Actually the component itself doesn't allow you to
020:         * drag, it is up to the component who uses this Gripper to add mouse motion listener and do the dragging.
021:         * The Gripper will paint itself so that user can tell immediately that it is something dragable.
022:         */
023:        public class Gripper extends JComponent implements  SwingConstants,
024:                Alignable, DragableHandle, UIResource {
025:
026:            /**
027:             * @see #getUIClassID
028:             * @see #readObject
029:             */
030:            private static final String uiClassID = "GripperUI";
031:
032:            /**
033:             * Identifies a change from rollover enabled to disabled or back
034:             * to enabled.
035:             */
036:            public static final String ROLLOVER_ENABLED_CHANGED_PROPERTY = "rolloverEnabled";
037:
038:            private boolean _rolloverEnabled = false;
039:
040:            private boolean _rollover;
041:
042:            public static final String ROLLOVER_PROPERTY = "ROLLOVER";
043:            public static final String SELECTED_PROPERTY = "SELECTED";
044:
045:            private int _orientation;
046:
047:            private boolean _selected;
048:
049:            /**
050:             * Creates a new horizontal separator.
051:             */
052:            public Gripper() {
053:                this (HORIZONTAL);
054:            }
055:
056:            /**
057:             * Creates a new separator with the specified horizontal or
058:             * vertical orientation.
059:             *
060:             * @param orientation an integer specifying
061:             *                    <code>SwingConstants.HORIZONTAL</code> or
062:             *                    <code>SwingConstants.VERTICAL</code>
063:             * @throws IllegalArgumentException if <code>orientation</code>
064:             *                                  is neither <code>SwingConstants.HORIZONTAL</code> nor
065:             *                                  <code>SwingConstants.VERTICAL</code>
066:             */
067:            public Gripper(int orientation) {
068:                setOrientation(orientation);
069:                setFocusable(false);
070:                updateUI();
071:            }
072:
073:            /**
074:             * Returns the L&F object that renders this component.
075:             *
076:             * @return the SeparatorUI object that renders this component
077:             */
078:            public GripperUI getUI() {
079:                return (GripperUI) ui;
080:            }
081:
082:            /**
083:             * Resets the UI property to a value from the current look and feel.
084:             *
085:             * @see javax.swing.JComponent#updateUI
086:             */
087:            @Override
088:            public void updateUI() {
089:                if (UIDefaultsLookup.get(uiClassID) == null) {
090:                    LookAndFeelFactory.installJideExtension();
091:                }
092:                setUI(UIManager.getUI(this ));
093:            }
094:
095:            /**
096:             * Returns the name of the L&F class that renders this component.
097:             *
098:             * @return the string "GripperUI"
099:             * @see javax.swing.JComponent#getUIClassID
100:             * @see javax.swing.UIDefaults#getUI
101:             */
102:            @Override
103:            public String getUIClassID() {
104:                return uiClassID;
105:            }
106:
107:            /**
108:             * return ture if it supports vertical orientation.
109:             *
110:             * @return ture if it supports vertical orientation
111:             */
112:            public boolean supportVerticalOrientation() {
113:                return true;
114:            }
115:
116:            /**
117:             * return ture if it supports horizontal orientation.
118:             *
119:             * @return ture if it supports horizontal orientation
120:             */
121:            public boolean supportHorizontalOrientation() {
122:                return true;
123:            }
124:
125:            /**
126:             * Changes the orientation.
127:             *
128:             * @param orientation the new orientation.
129:             */
130:            public void setOrientation(int orientation) {
131:                int old = _orientation;
132:                if (old != orientation) {
133:                    _orientation = orientation;
134:                    firePropertyChange(PROPERTY_ORIENTATION, old, orientation);
135:                }
136:            }
137:
138:            /**
139:             * Gets the orientation.
140:             *
141:             * @return orientation
142:             */
143:            public int getOrientation() {
144:                return _orientation;
145:            }
146:
147:            /**
148:             * Gets the cursor set in the component. If the component does
149:             * not have a cursor set, the cursor of its parent is returned.
150:             * If no cursor is set in the entire hierarchy,
151:             * <code>Cursor.DEFAULT_CURSOR</code> is returned.
152:             *
153:             * @see #setCursor
154:             * @since JDK1.1
155:             */
156:            @Override
157:            public Cursor getCursor() {
158:                if (isEnabled()) {
159:                    return Cursor.getPredefinedCursor(Cursor.MOVE_CURSOR);
160:                } else {
161:                    return super .getCursor();
162:                }
163:            }
164:
165:            /**
166:             * Gets the <code>rolloverEnabled</code> property.
167:             *
168:             * @return the value of the <code>rolloverEnabled</code> property
169:             * @see #setRolloverEnabled
170:             */
171:            public boolean isRolloverEnabled() {
172:                return _rolloverEnabled;
173:            }
174:
175:            /**
176:             * Sets the <code>rolloverEnabled</code> property, which
177:             * must be <code>true</code> for rollover effects to occur.
178:             * The default value for the <code>rolloverEnabled</code>
179:             * property is <code>false</code>.
180:             * Some look and feels might not implement rollover effects;
181:             * they will ignore this property.
182:             *
183:             * @param b if <code>true</code>, rollover effects should be painted
184:             * @see #isRolloverEnabled
185:             */
186:            public void setRolloverEnabled(boolean b) {
187:                boolean oldValue = _rolloverEnabled;
188:                if (b != oldValue) {
189:                    _rolloverEnabled = b;
190:                    firePropertyChange(ROLLOVER_ENABLED_CHANGED_PROPERTY,
191:                            oldValue, _rolloverEnabled);
192:                    repaint();
193:                }
194:            }
195:
196:            public boolean isRollover() {
197:                return _rollover;
198:            }
199:
200:            public void setRollover(boolean rollover) {
201:                boolean oldValue = _rollover;
202:                if (rollover != oldValue) {
203:                    _rollover = rollover;
204:                    firePropertyChange(ROLLOVER_PROPERTY, oldValue, rollover);
205:                    repaint();
206:                }
207:            }
208:
209:            public boolean isSelected() {
210:                return _selected;
211:            }
212:
213:            public void setSelected(boolean selected) {
214:                boolean oldValue = _selected;
215:                if (selected != oldValue) {
216:                    _selected = selected;
217:                    firePropertyChange(SELECTED_PROPERTY, oldValue, _selected);
218:                    repaint();
219:                }
220:            }
221:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.