Source Code Cross Referenced for RangeSlider.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:         * @(#)RangeSlider.java 11/22/2005
003:         *
004:         * Copyright 2002 - 2005 JIDE Software Inc. All rights reserved.
005:         */
006:        package com.jidesoft.swing;
007:
008:        import com.jidesoft.plaf.LookAndFeelFactory;
009:        import com.jidesoft.plaf.UIDefaultsLookup;
010:
011:        import javax.swing.*;
012:
013:        /**
014:         * <tt>RangeSlider</tt> is a slider that can be used to select a range. A regular slider has only one thumb.
015:         * So it can only be used to select one value. <tt>RangeSlider</tt> has two thumbs. Each one can be moved
016:         * independently or both are moved together.
017:         * <p/>
018:         * {@link #getLowValue()} will return the value of low range and {@link #getHighValue()} is the high range.
019:         */
020:        public class RangeSlider extends JSlider {
021:
022:            private static final String uiClassID = "RangeSliderUI";
023:
024:            /**
025:             * Creates a horizontal range slider with the range 0 to 100 and
026:             * initial low and high values both at 50.
027:             */
028:            public RangeSlider() {
029:            }
030:
031:            /**
032:             * Creates a range slider using the specified orientation with the
033:             * range 0 to 100 and initial low and high values both at 50.
034:             *
035:             * @param orientation the orientation of the <code>RangeSlider</code>.
036:             */
037:            public RangeSlider(int orientation) {
038:                super (orientation);
039:            }
040:
041:            /**
042:             * Creates a horizontal slider using the specified min and max
043:             * with an initial value equal to the average of the min plus max.
044:             * and initial low and high values both at 50.
045:             *
046:             * @param min the minimum value of the slider.
047:             * @param max the maximum value of the slider.
048:             */
049:            public RangeSlider(int min, int max) {
050:                super (min, max);
051:            }
052:
053:            /**
054:             * Creates a horizontal slider using the specified min, max, low and high value.
055:             *
056:             * @param min  the minimum value of the slider.
057:             * @param max  the maximum value of the slider.
058:             * @param low  the low value of the slider since it is a range.
059:             * @param high the high value of the slider since it is a range.
060:             */
061:            public RangeSlider(int min, int max, int low, int high) {
062:                super (new DefaultBoundedRangeModel(low, high - low, min, max));
063:            }
064:
065:            /**
066:             * Resets the UI property to a value from the current look and
067:             * feel.
068:             *
069:             * @see javax.swing.JComponent#updateUI
070:             */
071:            @Override
072:            public void updateUI() {
073:                if (UIDefaultsLookup.get(uiClassID) == null) {
074:                    LookAndFeelFactory.installJideExtension();
075:                }
076:                setUI(UIManager.getUI(this ));
077:            }
078:
079:            /**
080:             * Returns a string that specifies the name of the L&F class
081:             * that renders this component.
082:             *
083:             * @return the string "RangeSliderUI"
084:             * @see javax.swing.JComponent#getUIClassID
085:             * @see javax.swing.UIDefaults#getUI
086:             */
087:            @Override
088:            public String getUIClassID() {
089:                return uiClassID;
090:            }
091:
092:            /**
093:             * Returns the range slider's low value.
094:             *
095:             * @return the range slider's low value.
096:             */
097:            public int getLowValue() {
098:                return getModel().getValue();
099:            }
100:
101:            /**
102:             * Returns the range slider's high value.
103:             *
104:             * @return the range slider's high value.
105:             */
106:            public int getHighValue() {
107:                return getModel().getValue() + getModel().getExtent();
108:            }
109:
110:            /**
111:             * Returns true if the specified value is within the range slider's range.
112:             *
113:             * @param value value
114:             * @return true if the specified value is within the range slider's range.
115:             */
116:            public boolean contains(int value) {
117:                return (value >= getLowValue() && value <= getHighValue());
118:            }
119:
120:            /**
121:             * Sets the range slider's low value.  This method just forwards
122:             * the value to the model.
123:             *
124:             * @param lowValue the new low value
125:             */
126:            public void setLowValue(int lowValue) {
127:                int high;
128:                if ((lowValue + getModel().getExtent()) > getMaximum()) {
129:                    high = getMaximum();
130:                } else {
131:                    high = getHighValue();
132:                }
133:                int extent = high - lowValue;
134:
135:                getModel().setRangeProperties(lowValue, extent, getMinimum(),
136:                        getMaximum(), true);
137:            }
138:
139:            /**
140:             * Sets the range slider's high value.  This method just forwards
141:             * the value to the model.
142:             *
143:             * @param highValue the new high value
144:             */
145:            public void setHighValue(int highValue) {
146:                getModel().setExtent(highValue - getLowValue());
147:            }
148:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.