Source Code Cross Referenced for ButtonPanel.java in  » Web-Framework » wingS » com » javujavu » javux » demo » 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 » wingS » com.javujavu.javux.demo 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         *	Javu WingS - Lightweight Java Component Set
003:         *	Copyright (c) 2005-2007 Krzysztof A. Sadlocha
004:         *	e-mail: ksadlocha@programics.com
005:         *
006:         *	This library is free software; you can redistribute it and/or
007:         *	modify it under the terms of the GNU Lesser General Public
008:         *	License as published by the Free Software Foundation; either
009:         *	version 2.1 of the License, or (at your option) any later version.
010:         *
011:         *	This library is distributed in the hope that it will be useful,
012:         *	but WITHOUT ANY WARRANTY; without even the implied warranty of
013:         *	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
014:         *	Lesser General Public License for more details.
015:         *
016:         *	You should have received a copy of the GNU Lesser General Public
017:         *	License along with this library; if not, write to the Free Software
018:         *	Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
019:         */
020:
021:        package com.javujavu.javux.demo;
022:
023:        import java.awt.BorderLayout;
024:        import java.awt.GridBagConstraints;
025:        import java.awt.GridBagLayout;
026:        import java.awt.GridLayout;
027:        import java.awt.Insets;
028:        import java.awt.event.KeyEvent;
029:
030:        import com.javujavu.javux.wings.RadioGroup;
031:        import com.javujavu.javux.wings.WingButton;
032:        import com.javujavu.javux.wings.WingCheckBox;
033:        import com.javujavu.javux.wings.WingLabel;
034:        import com.javujavu.javux.wings.WingPanel;
035:        import com.javujavu.javux.wings.item.LabelItem;
036:
037:        public class ButtonPanel extends WingPanel {
038:            public ButtonPanel(WingSetPanel owner) {
039:                this .setLayout(new GridBagLayout());
040:                WingPanel panel = new WingPanel(new GridLayout(0, 2, 8, 8));
041:                GridBagConstraints c = new GridBagConstraints();
042:                c.insets = new Insets(10, 10, 10, 10);
043:                c.anchor = GridBagConstraints.CENTER;
044:                c.fill = GridBagConstraints.BOTH;
045:                c.weightx = 1.0;
046:                c.weighty = 1.0;
047:                c.gridwidth = GridBagConstraints.REMAINDER;
048:                this .add(panel, c);
049:                c.insets = new Insets(0, 10, 10, 10);
050:                c.weighty = 0.0;
051:                WingPanel panely = new WingPanel(new GridBagLayout());
052:                this .add(panely, c);
053:
054:                WingPanel left, leftAll;
055:                panel.add(leftAll = new WingPanel(new BorderLayout()));
056:                leftAll.add(left = new WingPanel(new GridBagLayout()),
057:                        BorderLayout.CENTER);
058:                left.setStyleId("border1");
059:                LabelItem panelTip = new LabelItem(
060:                        "use SPACEBAR to press focused\nbutton from the keyboard\nand TAB to transfer the focus\nto the next component",
061:                        WingSet.imgThumbsup);
062:                left.setTooltip(panelTip);
063:
064:                c = new GridBagConstraints();
065:                c.insets = new Insets(3, 3, 0, 3);
066:                c.gridwidth = GridBagConstraints.REMAINDER;
067:                c.weighty = 1.0;
068:                c.weightx = 1.0;
069:                WingButton b;
070:                c.gridwidth = 1;
071:                c.anchor = GridBagConstraints.EAST;
072:                left.add(b = new WingButton("text only"), c);
073:                b.setTooltip(new LabelItem("text only button\ndefault style",
074:                        WingSet.imgEye));
075:                c.gridwidth = GridBagConstraints.REMAINDER;
076:                c.anchor = GridBagConstraints.WEST;
077:                left.add(b = new WingButton(), c);
078:                b.setStyleId("smile");
079:                b
080:                        .setTooltip(new LabelItem(
081:                                "icon only button\nstyle: smile (stylesheet wingsetdemo.ini)",
082:                                WingSet.imgAngel));
083:                c.gridwidth = 1;
084:                c.anchor = GridBagConstraints.EAST;
085:                left.add(b = new WingButton("text left"), c);
086:                b.setStyleId("smile");
087:                b
088:                        .setTooltip(new LabelItem(
089:                                "button with text position left\nstyle: smile (stylesheet wingsetdemo.ini)",
090:                                WingSet.imgGlasses, LEFT, RIGHT));
091:                b.setTextPosition(LEFT);
092:                c.gridwidth = GridBagConstraints.REMAINDER;
093:                c.anchor = GridBagConstraints.WEST;
094:                left.add(b = new WingButton("text and icon"), c);
095:                b.setStyleId("smile");
096:                b
097:                        .setTooltip(new LabelItem(
098:                                "button with text and icon\nstyle: smile (stylesheet wingsetdemo.ini)",
099:                                WingSet.imgGnash, RIGHT, LEFT));
100:                c.gridwidth = 1;
101:                c.anchor = GridBagConstraints.EAST;
102:                left.add(b = new WingButton(WingSet.imgTongue), c);
103:                b.setTooltip(new LabelItem(
104:                        "button with icon as label\ndefault style",
105:                        WingSet.imgJokingly, LEFT, RIGHT));
106:                c.gridwidth = GridBagConstraints.REMAINDER;
107:                c.anchor = GridBagConstraints.WEST;
108:                left.add(b = new WingButton(new LabelItem("text and icon",
109:                        WingSet.imgTongue)), c);
110:                b.setTooltip(new LabelItem(
111:                        "button with icon and text as label\ndefault style",
112:                        WingSet.imgJokingly));
113:                c.gridwidth = 1;
114:                c.anchor = GridBagConstraints.EAST;
115:                left.add(b = new WingButton("multiline\ntext"), c);
116:                b
117:                        .setTooltip(new LabelItem(
118:                                "button with multiline text\nuse '\\n' to break line\ndefault style",
119:                                WingSet.imgJokingly, LEFT, RIGHT));
120:                c.gridwidth = GridBagConstraints.REMAINDER;
121:                c.anchor = GridBagConstraints.WEST;
122:                left.add(b = new WingButton("multiline\ntext\nand icon"), c);
123:                b.setStyleId("smile");
124:                b
125:                        .setTooltip(new LabelItem(
126:                                "button with multiline text and icon\nuse '\\n' to break line\nstyle: smile (stylesheet wingsetdemo.ini)",
127:                                WingSet.imgLaughing, RIGHT, LEFT));
128:                c.anchor = GridBagConstraints.CENTER;
129:                left.add(b = new WingButton("animated icon"), c);
130:                b.setStyleId("anim");
131:                b
132:                        .setTooltip(new LabelItem(
133:                                "button with animated icon\nstyle: anim (stylesheet wingsetdemo.ini)",
134:                                WingSet.imgScared));
135:                c.gridwidth = 1;
136:                c.anchor = GridBagConstraints.EAST;
137:                left.add(b = new WingButton("with \u0332Shortcut\nAlt+S"), c);
138:                b
139:                        .setTooltip(new LabelItem(
140:                                "button with shortcut Alt+S\nuse u\u0332nicod\u0332e lo\u0332w li\u0332ne '\\ u0332' to \u0332underli\u0332ne \u0332sin\u0332gle \u0332char\ndefault style",
141:                                WingSet.imgSilence, LEFT, RIGHT));
142:                b.setShortcut(KeyEvent.VK_S, KeyEvent.ALT_MASK);
143:                c.anchor = GridBagConstraints.WEST;
144:                c.gridwidth = GridBagConstraints.REMAINDER;
145:                left.add(b = new WingButton("with \u0332Shortcut S"), c);
146:                b
147:                        .setTooltip(new LabelItem(
148:                                "button with shortcut S\nuse u\u0332nicod\u0332e lo\u0332w li\u0332ne '\\ u0332' to \u0332underli\u0332ne \u0332sin\u0332gle \u0332char\ndefault style",
149:                                WingSet.imgSilence, RIGHT, LEFT));
150:                b.setShortcut(KeyEvent.VK_S, 0);
151:                c.gridwidth = 1;
152:                c.anchor = GridBagConstraints.EAST;
153:                left.add(b = new WingButton("\u0332repeating"), c);
154:                b
155:                        .setTooltip(new LabelItem(
156:                                "repeating button, check 'show event log'\n on debug option tab to see how it works\ndefault style\nshortcut R",
157:                                WingSet.imgSilence));
158:                b.setRepeat(true);
159:                b.setShortcut(KeyEvent.VK_R, 0);
160:                c.anchor = GridBagConstraints.WEST;
161:                c.gridwidth = GridBagConstraints.REMAINDER;
162:                left.add(b = new WingButton("\u0332fast action"), c);
163:                b
164:                        .setTooltip(new LabelItem(
165:                                "fast action button, check 'show event log'\n on debug option tab to see how it works\ndefault style\nshortcut F",
166:                                WingSet.imgYawn));
167:                b.setShortcut(KeyEvent.VK_F, 0);
168:                b.setFastAction(true);
169:                c.insets = new Insets(3, 3, 3, 3);
170:                c.anchor = GridBagConstraints.CENTER;
171:                left.add(b = new WingButton("disabled"), c);
172:                b.setTooltip(new LabelItem("disabled button\ndefault style",
173:                        WingSet.imgSmile));
174:                b.setEnabled(false);
175:
176:                WingPanel right, rightAll;
177:                panel.add(rightAll = new WingPanel(new BorderLayout()));
178:                WingLabel l;
179:                rightAll.add(l = new WingLabel("Button Style Customization",
180:                        WingLabel.CENTER), BorderLayout.NORTH);
181:                l.setStyleId("border2");
182:                rightAll.add(right = new WingPanel(new GridBagLayout()),
183:                        BorderLayout.CENTER);
184:                right.setTooltip(panelTip);
185:                right.setStyleId("border3");
186:
187:                c.insets = new Insets(3, 3, 0, 3);
188:                right.add(b = new WingButton(
189:                        "Custom TopStyle\nclick here first!"), c);
190:                b.setStyleId("vpopup");
191:                b.setTextPosition(LEFT);
192:                b.setFastAction(true);
193:                b
194:                        .setTooltip(new LabelItem(
195:                                "button with a TopStyle\nTopStyle is an extra style overriding stylesheet settings \ndynamically at run time\nclick to change settings\n\nstyle: vmenu (stylesheet wingsetdemo.ini)",
196:                                WingSet.imgIcon, LEFT, RIGHT));
197:                new TopStyleEditor(b, b, 20, 11, true);
198:                right.add(b = new WingButton("Custom Image"), c);
199:                b.setStyleId("custom_image");
200:                b
201:                        .setTooltip(new LabelItem(
202:                                "button with custom background image\nstyle: custom_image (stylesheet wingsetdemo.ini)",
203:                                WingSet.imgLaughing));
204:                c.gridwidth = 1;
205:                right.add(b = new WingButton("Custom Icon"), c);
206:                b.setStyleId("custom_icon");
207:                b
208:                        .setTooltip(new LabelItem(
209:                                "button with custom icon image\nstyle: custom_icon (stylesheet wingsetdemo.ini)",
210:                                WingSet.imgCrying));
211:                c.gridwidth = GridBagConstraints.REMAINDER;
212:                right.add(b = new WingButton("Custom Text"), c);
213:                b.setStyleId("custom_text");
214:                b
215:                        .setTooltip(new LabelItem(
216:                                "button with custom text style\nstyle: custom_text (stylesheet wingsetdemo.ini)",
217:                                WingSet.imgGlasses));
218:                right.add(b = new WingButton("Total Custom"), c);
219:                b.setStyleId("custom_all");
220:                b
221:                        .setTooltip(new LabelItem(
222:                                "button with custom text,background and icon style\nstyle: custom_all (stylesheet wingsetdemo.ini)",
223:                                WingSet.imgBomb));
224:                c.gridwidth = 1;
225:                c.insets = new Insets(3, 3, 3, 3);
226:                right.add(b = new WingButton("link like button"), c);
227:                b.setStyleId("link_like");
228:                b
229:                        .setTooltip(new LabelItem(
230:                                "link like custom button style\nstyle: link_like (stylesheet wingsetdemo.ini)",
231:                                WingSet.imgSad));
232:                b.setFastAction(true);
233:                c.gridwidth = GridBagConstraints.REMAINDER;
234:                right.add(b = new WingButton("No Image"), c);
235:                b.setStyleId("custom_no_image");
236:                b
237:                        .setTooltip(new LabelItem(
238:                                "custom button style with no background image\nstyle: custom_no_image (stylesheet wingsetdemo.ini)",
239:                                WingSet.imgMusic));
240:
241:                c = new GridBagConstraints();
242:                c.weightx = 1.0;
243:                c.fill = GridBagConstraints.NONE;
244:                WingPanel panelx;
245:                LabelItem tx = new LabelItem("tool button style\nstyle: tool",
246:                        WingSet.imgYawn);
247:
248:                panely.add(panelx = new WingPanel(new GridLayout(1, 0)), c);
249:                panelx.add(b = new WingButton(WingSet.imgGlasses));
250:                b.setStyleId("tool");
251:                b.setTooltip(tx);
252:                panelx.add(b = new WingButton(WingSet.imgEye));
253:                b.setStyleId("tool");
254:                b.setTooltip(tx);
255:                panelx.add(new WingLabel());
256:                tx = new LabelItem("tool toggle button style\nstyle: tool",
257:                        WingSet.imgYawn);
258:                RadioGroup r = new RadioGroup();
259:                WingCheckBox cb;
260:                panelx.add(cb = new WingCheckBox(WingSet.imgSmile,
261:                        WingCheckBox.TOGGLE));
262:                b.setStyleId("tool");
263:                cb.setTooltip(tx);
264:                r.add(cb);
265:                panelx.add(cb = new WingCheckBox(WingSet.imgSad,
266:                        WingCheckBox.TOGGLE));
267:                cb.setStyleId("tool");
268:                cb.setTooltip(tx);
269:                r.add(cb);
270:                cb.setSelected(true);
271:                panelx.add(cb = new WingCheckBox(WingSet.imgScared,
272:                        WingCheckBox.TOGGLE));
273:                cb.setStyleId("tool");
274:                cb.setTooltip(tx);
275:                r.add(cb);
276:                panelx.add(cb = new WingCheckBox(WingSet.imgBomb,
277:                        WingCheckBox.TOGGLE));
278:                cb.setStyleId("tool");
279:                cb.setTooltip(tx);
280:                cb.setEnabled(false);
281:                panelx.add(cb = new WingCheckBox(WingSet.imgTongue,
282:                        WingCheckBox.TOGGLE));
283:                cb.setStyleId("tool");
284:                cb.setTooltip(tx);
285:                cb.setSelected(true);
286:                cb.setEnabled(false);
287:
288:                tx = new LabelItem("toolbar button style\nstyle: bar.tool",
289:                        WingSet.imgYawn);
290:                panely.add(panelx = new WingPanel(new GridLayout(1, 0)), c);
291:                panelx.add(b = new WingButton(WingSet.imgGlasses));
292:                b.setStyleId("bar.tool");
293:                b.setTooltip(tx);
294:                panelx.add(b = new WingButton(WingSet.imgEye));
295:                b.setStyleId("bar.tool");
296:                b.setTooltip(tx);
297:                panelx.add(new WingLabel());
298:                tx = new LabelItem(
299:                        "toolbar toggle button style\nstyle: bar.tool",
300:                        WingSet.imgYawn);
301:                r = new RadioGroup();
302:                panelx.add(cb = new WingCheckBox(WingSet.imgSmile,
303:                        WingCheckBox.TOGGLE));
304:                cb.setStyleId("bar.tool");
305:                cb.setTooltip(tx);
306:                r.add(cb);
307:                panelx.add(cb = new WingCheckBox(WingSet.imgSad,
308:                        WingCheckBox.TOGGLE));
309:                cb.setStyleId("bar.tool");
310:                cb.setTooltip(tx);
311:                r.add(cb);
312:                cb.setSelected(true);
313:                panelx.add(cb = new WingCheckBox(WingSet.imgScared,
314:                        WingCheckBox.TOGGLE));
315:                cb.setStyleId("bar.tool");
316:                cb.setTooltip(tx);
317:                r.add(cb);
318:                panelx.add(cb = new WingCheckBox(WingSet.imgBomb,
319:                        WingCheckBox.TOGGLE));
320:                cb.setStyleId("bar.tool");
321:                cb.setTooltip(tx);
322:                cb.setEnabled(false);
323:                panelx.add(cb = new WingCheckBox(WingSet.imgTongue,
324:                        WingCheckBox.TOGGLE));
325:                cb.setStyleId("bar.tool");
326:                cb.setTooltip(tx);
327:                cb.setSelected(true);
328:                cb.setEnabled(false);
329:
330:            }
331:
332:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.