Source Code Cross Referenced for Label.java in  » Web-Framework » ThinWire » thinwire » ui » 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 » Web Framework » ThinWire » thinwire.ui 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:        #IFNDEF ALT_LICENSE
003:                                   ThinWire(R) RIA Ajax Framework
004:                         Copyright (C) 2003-2007 Custom Credit Systems
005:
006:          This library is free software; you can redistribute it and/or modify it under
007:          the terms of the GNU Lesser General Public License as published by the Free
008:          Software Foundation; either version 2.1 of the License, or (at your option) any
009:          later version.
010:
011:          This library is distributed in the hope that it will be useful, but WITHOUT ANY
012:          WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
013:          PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
014:
015:          You should have received a copy of the GNU Lesser General Public License along
016:          with this library; if not, write to the Free Software Foundation, Inc., 59
017:          Temple Place, Suite 330, Boston, MA 02111-1307 USA
018:
019:          Users who would rather have a commercial license, warranty or support should
020:          contact the following company who invented, built and supports the technology:
021:          
022:                        Custom Credit Systems, Richardson, TX 75081, USA.
023:           	            email: info@thinwire.com    ph: +1 (888) 644-6405
024:         	                        http://www.thinwire.com
025:        #ENDIF
026:         [ v1.2_RC2 ] 
027:         */
028:        package thinwire.ui;
029:
030:        /**
031:         * A <code>Label</code> is the text that appears next to a control on a
032:         * screen.
033:         * <p>
034:         * <p>
035:         * <b>Example:</b> <br>
036:         * <img src="doc-files/Label-1.png"> <br>
037:         * 
038:         * <pre>
039:         * Dialog dlg = new Dialog(&quot;Label Test&quot;);
040:         * dlg.setBounds(25, 25, 415, 150);
041:         * 
042:         * final Label lbl = new Label(&quot;Initial 1st Label&quot;);
043:         * lbl.setBounds(25, 25, 150, 30);
044:         * 
045:         * Button btn = new Button(&quot;Toggle Text&quot;);
046:         * btn.setBounds(300, 20, 100, 30);
047:         * 
048:         * btn.addActionListener(Button.ACTION_CLICK, new ActionListener() {
049:         *     public void actionPerformed(ActionEvent ev) {
050:         *         if (&quot;Initial 1st Label&quot;.equals(lbl.getText())) {
051:         *             lbl.setText(&quot;The text has now been toggled.&quot;);
052:         *         } else {
053:         *             lbl.setText(&quot;Initial 1st Label&quot;);
054:         *         }
055:         *     }
056:         * });
057:         * 
058:         * dlg.getChildren().add(lbl);
059:         * dlg.getChildren().add(btn);
060:         * dlg.setVisible(true);
061:         * </pre>
062:         * 
063:         * </p>
064:         * <p>
065:         * <b>Keyboard Navigation:</b><br>
066:         * <table border="1">
067:         * <tr>
068:         * <td>KEY</td>
069:         * <td>RESPONSE</td>
070:         * <td>NOTE</td>
071:         * </tr>
072:         * </table>
073:         * </p>
074:         * 
075:         * @author Joshua J. Gertzen
076:         */
077:        public class Label extends AbstractTextComponent implements 
078:                AlignTextComponent {
079:            public static final String PROPERTY_LABEL_FOR = "labelFor";
080:            public static final String PROPERTY_WRAP_TEXT = "wrapText";
081:
082:            private AlignX alignX = AlignX.LEFT;
083:            private Component labelFor = null;
084:            private boolean wrapText;
085:
086:            /**
087:             * Constructs a new Label with no text.
088:             */
089:            public Label() {
090:                this (null);
091:            }
092:
093:            /**
094:             * Constructs a new Label with the specified text.
095:             * @param text the text to display on the Label.
096:             */
097:            public Label(String text) {
098:                if (text != null)
099:                    setText(text);
100:                setFocusCapable(false);
101:                setWrapText(false);
102:            }
103:
104:            public AlignX getAlignX() {
105:                return alignX;
106:            }
107:
108:            public void setAlignX(AlignX alignX) {
109:                if (alignX == null)
110:                    throw new IllegalArgumentException(PROPERTY_ALIGN_X
111:                            + " == null");
112:                AlignX oldAlignX = this .alignX;
113:                this .alignX = alignX;
114:                firePropertyChange(this , PROPERTY_ALIGN_X, oldAlignX, alignX);
115:            }
116:
117:            /**
118:             * Returns the component that this label is associated with.
119:             * 
120:             * @return the Component associated with this Label.
121:             */
122:            public Component getLabelFor() {
123:                return labelFor;
124:            }
125:
126:            /**
127:             * This method links a label with an onscreen component.
128:             * 
129:             * @param labelFor the component to link with the label
130:             */
131:            public void setLabelFor(Component labelFor) {
132:                Component oldLabelFor = this .labelFor;
133:                this .labelFor = labelFor;
134:                if (labelFor != null)
135:                    ((AbstractComponent) labelFor).setLabel(this );
136:                firePropertyChange(this , PROPERTY_LABEL_FOR, oldLabelFor,
137:                        labelFor);
138:            }
139:
140:            public boolean isWrapText() {
141:                return wrapText;
142:            }
143:
144:            public void setWrapText(boolean wrapText) {
145:                boolean oldWrap = this.wrapText;
146:                this.wrapText = wrapText;
147:                if (this.wrapText != oldWrap)
148:                    firePropertyChange(this, PROPERTY_WRAP_TEXT, oldWrap,
149:                            this.wrapText);
150:            }
151:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.