Source Code Cross Referenced for ButtonTest.java in  » Ajax » NextApp-Echo2 » nextapp » echo2 » testapp » interactive » testscreen » 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 » Ajax » NextApp Echo2 » nextapp.echo2.testapp.interactive.testscreen 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


0001:        /* 
0002:         * This file is part of the Echo Web Application Framework (hereinafter "Echo").
0003:         * Copyright (C) 2002-2005 NextApp, Inc.
0004:         *
0005:         * Version: MPL 1.1/GPL 2.0/LGPL 2.1
0006:         *
0007:         * The contents of this file are subject to the Mozilla Public License Version
0008:         * 1.1 (the "License"); you may not use this file except in compliance with
0009:         * the License. You may obtain a copy of the License at
0010:         * http://www.mozilla.org/MPL/
0011:         *
0012:         * Software distributed under the License is distributed on an "AS IS" basis,
0013:         * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
0014:         * for the specific language governing rights and limitations under the
0015:         * License.
0016:         *
0017:         * Alternatively, the contents of this file may be used under the terms of
0018:         * either the GNU General Public License Version 2 or later (the "GPL"), or
0019:         * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
0020:         * in which case the provisions of the GPL or the LGPL are applicable instead
0021:         * of those above. If you wish to allow use of your version of this file only
0022:         * under the terms of either the GPL or the LGPL, and not to allow others to
0023:         * use your version of this file under the terms of the MPL, indicate your
0024:         * decision by deleting the provisions above and replace them with the notice
0025:         * and other provisions required by the GPL or the LGPL. If you do not delete
0026:         * the provisions above, a recipient may use your version of this file under
0027:         * the terms of any one of the MPL, the GPL or the LGPL.
0028:         */
0029:
0030:        package nextapp.echo2.testapp.interactive.testscreen;
0031:
0032:        import java.util.ArrayList;
0033:        import java.util.List;
0034:        import java.util.Locale;
0035:
0036:        import nextapp.echo2.app.Alignment;
0037:        import nextapp.echo2.app.Button;
0038:        import nextapp.echo2.app.CheckBox;
0039:        import nextapp.echo2.app.Color;
0040:        import nextapp.echo2.app.Column;
0041:        import nextapp.echo2.app.Extent;
0042:        import nextapp.echo2.app.Font;
0043:        import nextapp.echo2.app.Grid;
0044:        import nextapp.echo2.app.Insets;
0045:        import nextapp.echo2.app.Label;
0046:        import nextapp.echo2.app.LayoutDirection;
0047:        import nextapp.echo2.app.RadioButton;
0048:        import nextapp.echo2.app.SplitPane;
0049:        import nextapp.echo2.app.button.AbstractButton;
0050:        import nextapp.echo2.app.button.ButtonGroup;
0051:        import nextapp.echo2.app.button.ToggleButton;
0052:        import nextapp.echo2.app.event.ActionEvent;
0053:        import nextapp.echo2.app.event.ActionListener;
0054:        import nextapp.echo2.app.event.ChangeEvent;
0055:        import nextapp.echo2.app.event.ChangeListener;
0056:        import nextapp.echo2.app.layout.SplitPaneLayoutData;
0057:        import nextapp.echo2.testapp.interactive.ButtonColumn;
0058:        import nextapp.echo2.testapp.interactive.InteractiveApp;
0059:        import nextapp.echo2.testapp.interactive.StyleUtil;
0060:        import nextapp.echo2.testapp.interactive.Styles;
0061:        import nextapp.echo2.testapp.interactive.TestGrid;
0062:
0063:        /**
0064:         * Interactive test module for <code>AbstractButton</code>-derived components.
0065:         */
0066:        public class ButtonTest extends SplitPane {
0067:
0068:            /**
0069:             * Interface used to apply style information to all test components.
0070:             */
0071:            private interface Applicator {
0072:
0073:                /**
0074:                 * Applies style information.
0075:                 * 
0076:                 * @param button the target button
0077:                 */
0078:                public void apply(AbstractButton button);
0079:            }
0080:
0081:            private List buttonList;
0082:
0083:            /**
0084:             * Writes <code>ActionEvent</code>s to console.
0085:             */
0086:            private ActionListener actionListener = new ActionListener() {
0087:
0088:                /**
0089:                 * @see nextapp.echo2.app.event.ActionListener#actionPerformed(nextapp.echo2.app.event.ActionEvent)
0090:                 */
0091:                public void actionPerformed(ActionEvent e) {
0092:                    ((InteractiveApp) getApplicationInstance()).consoleWrite(e
0093:                            .toString());
0094:                }
0095:            };
0096:
0097:            /**
0098:             * Writes <code>ChangeEvent</code>s to console.
0099:             */
0100:            private ChangeListener changeListener = new ChangeListener() {
0101:
0102:                /**
0103:                 * @see nextapp.echo2.app.event.ChangeListener#stateChanged(nextapp.echo2.app.event.ChangeEvent)
0104:                 */
0105:                public void stateChanged(ChangeEvent e) {
0106:                    ((InteractiveApp) getApplicationInstance()).consoleWrite(e
0107:                            .toString());
0108:                }
0109:            };
0110:
0111:            public ButtonTest() {
0112:                super (SplitPane.ORIENTATION_HORIZONTAL, new Extent(250,
0113:                        Extent.PX));
0114:                setStyleName("DefaultResizable");
0115:
0116:                SplitPaneLayoutData splitPaneLayoutData;
0117:
0118:                Column controlGroupsColumn = new Column();
0119:                controlGroupsColumn.setCellSpacing(new Extent(5));
0120:                controlGroupsColumn.setStyleName("TestControlsColumn");
0121:                add(controlGroupsColumn);
0122:
0123:                final TestGrid testGrid = new TestGrid();
0124:                splitPaneLayoutData = new SplitPaneLayoutData();
0125:                splitPaneLayoutData.setInsets(new Insets(15));
0126:                testGrid.setLayoutData(splitPaneLayoutData);
0127:                add(testGrid);
0128:
0129:                buttonList = new ArrayList();
0130:
0131:                Button button;
0132:                testGrid.addHeaderRow("Button");
0133:
0134:                button = new Button();
0135:                testGrid.addTestRow("No Content", button);
0136:                buttonList.add(button);
0137:
0138:                button = new Button("Test Button");
0139:                testGrid.addTestRow("Text", button);
0140:                buttonList.add(button);
0141:
0142:                button = new Button(Styles.ICON_LOGO);
0143:                testGrid.addTestRow("Icon", button);
0144:                buttonList.add(button);
0145:
0146:                button = new Button("Test Button", Styles.ICON_LOGO);
0147:                testGrid.addTestRow("Text and Icon", button);
0148:                buttonList.add(button);
0149:
0150:                CheckBox checkBox;
0151:                testGrid.addHeaderRow("CheckBox");
0152:
0153:                checkBox = new CheckBox();
0154:                testGrid.addTestRow("No Content", checkBox);
0155:                buttonList.add(checkBox);
0156:
0157:                checkBox = new CheckBox("Test CheckBox");
0158:                testGrid.addTestRow("Text", checkBox);
0159:                buttonList.add(checkBox);
0160:
0161:                checkBox = new CheckBox(Styles.ICON_LOGO);
0162:                testGrid.addTestRow("Icon", checkBox);
0163:                buttonList.add(checkBox);
0164:
0165:                checkBox = new CheckBox("Test CheckBox", Styles.ICON_LOGO);
0166:                testGrid.addTestRow("Text and Icon", checkBox);
0167:                buttonList.add(checkBox);
0168:
0169:                RadioButton radioButton;
0170:                testGrid.addHeaderRow("RadioButton");
0171:
0172:                ButtonGroup buttonGroup = new ButtonGroup();
0173:
0174:                radioButton = new RadioButton();
0175:                radioButton.setGroup(buttonGroup);
0176:                testGrid.addTestRow("No Content", radioButton);
0177:                buttonList.add(radioButton);
0178:
0179:                radioButton = new RadioButton("Test RadioButton");
0180:                radioButton.setGroup(buttonGroup);
0181:                testGrid.addTestRow("Text", radioButton);
0182:                buttonList.add(radioButton);
0183:
0184:                radioButton = new RadioButton(Styles.ICON_LOGO);
0185:                radioButton.setGroup(buttonGroup);
0186:                testGrid.addTestRow("Icon", radioButton);
0187:                buttonList.add(radioButton);
0188:
0189:                radioButton = new RadioButton("Test RadioButton",
0190:                        Styles.ICON_LOGO);
0191:                radioButton.setGroup(buttonGroup);
0192:                testGrid.addTestRow("Text and Icon", radioButton);
0193:                buttonList.add(radioButton);
0194:
0195:                buttonGroup = new ButtonGroup();
0196:                Grid radioGrid = new Grid();
0197:                radioGrid.setInsets(new Insets(10));
0198:                for (int i = 1; i <= 4; ++i) {
0199:                    radioButton = new RadioButton(Integer.toString(i));
0200:                    radioButton.setGroup(buttonGroup);
0201:                    radioGrid.add(radioButton);
0202:                    buttonList.add(radioButton);
0203:                }
0204:                testGrid.addTestRow("Separate ButtonGroup", radioGrid);
0205:
0206:                radioButton = new RadioButton("Test");
0207:                buttonList.add(radioButton);
0208:                testGrid.addTestRow("Null ButtonGroup", radioButton);
0209:
0210:                ButtonColumn controlsColumn;
0211:
0212:                // Create 'AbstractButton Controls Group'
0213:
0214:                controlsColumn = new ButtonColumn();
0215:                controlGroupsColumn.add(controlsColumn);
0216:
0217:                controlsColumn.add(new Label("General Settings"));
0218:
0219:                controlsColumn.addButton("Toggle Container Cell Spacing",
0220:                        new ActionListener() {
0221:                            public void actionPerformed(ActionEvent e) {
0222:                                if (testGrid.getInsets() != null
0223:                                        && testGrid.getInsets().getTop()
0224:                                                .equals(new Extent(5))) {
0225:                                    testGrid.setInsets(new Insets(0));
0226:                                } else {
0227:                                    testGrid.setInsets(new Insets(5));
0228:                                }
0229:                            }
0230:                        });
0231:                controlsColumn.addButton("Add ActionListener",
0232:                        new ActionListener() {
0233:                            public void actionPerformed(ActionEvent e) {
0234:                                apply(new Applicator() {
0235:                                    public void apply(AbstractButton button) {
0236:                                        button
0237:                                                .addActionListener(actionListener);
0238:                                    }
0239:                                });
0240:                            }
0241:                        });
0242:                controlsColumn.addButton("Remove ActionListener",
0243:                        new ActionListener() {
0244:                            public void actionPerformed(ActionEvent e) {
0245:                                apply(new Applicator() {
0246:                                    public void apply(AbstractButton button) {
0247:                                        button
0248:                                                .removeActionListener(actionListener);
0249:                                    }
0250:                                });
0251:                            }
0252:                        });
0253:                controlsColumn.addButton("Add ChangeListener",
0254:                        new ActionListener() {
0255:                            public void actionPerformed(ActionEvent e) {
0256:                                apply(new Applicator() {
0257:                                    public void apply(AbstractButton button) {
0258:                                        if (button instanceof  ToggleButton) {
0259:                                            ((ToggleButton) button)
0260:                                                    .addChangeListener(changeListener);
0261:                                        }
0262:                                    }
0263:                                });
0264:                            }
0265:                        });
0266:                controlsColumn.addButton("Remove ChangeListener",
0267:                        new ActionListener() {
0268:                            public void actionPerformed(ActionEvent e) {
0269:                                apply(new Applicator() {
0270:                                    public void apply(AbstractButton button) {
0271:                                        if (button instanceof  ToggleButton) {
0272:                                            ((ToggleButton) button)
0273:                                                    .removeChangeListener(changeListener);
0274:                                        }
0275:                                    }
0276:                                });
0277:                            }
0278:                        });
0279:                controlsColumn.addButton("Set StyleName = Null",
0280:                        new ActionListener() {
0281:                            public void actionPerformed(ActionEvent e) {
0282:                                apply(new Applicator() {
0283:                                    public void apply(AbstractButton button) {
0284:                                        button.setStyleName(null);
0285:                                    }
0286:                                });
0287:                            }
0288:                        });
0289:                controlsColumn.addButton("Set StyleName = Default",
0290:                        new ActionListener() {
0291:                            public void actionPerformed(ActionEvent e) {
0292:                                apply(new Applicator() {
0293:                                    public void apply(AbstractButton button) {
0294:                                        button.setStyleName("Default");
0295:                                    }
0296:                                });
0297:                            }
0298:                        });
0299:                controlsColumn.addButton("Set Text = Short",
0300:                        new ActionListener() {
0301:                            public void actionPerformed(ActionEvent e) {
0302:                                apply(new Applicator() {
0303:                                    public void apply(AbstractButton button) {
0304:                                        if (button.getText() != null) {
0305:                                            button.setText("Test Button");
0306:                                        }
0307:                                    }
0308:                                });
0309:                            }
0310:                        });
0311:                controlsColumn.addButton("Set Text = Long",
0312:                        new ActionListener() {
0313:                            public void actionPerformed(ActionEvent e) {
0314:                                apply(new Applicator() {
0315:                                    public void apply(AbstractButton button) {
0316:                                        if (button.getText() != null) {
0317:                                            button
0318:                                                    .setText("This button has a longer label.  The quick brown fox jumps over the lazy brown dog.");
0319:                                        }
0320:                                    }
0321:                                });
0322:                            }
0323:                        });
0324:
0325:                controlsColumn.addButton("Toggle ToolTip Text",
0326:                        new ActionListener() {
0327:                            public void actionPerformed(ActionEvent e) {
0328:                                apply(new Applicator() {
0329:                                    public void apply(AbstractButton button) {
0330:                                        if (button.getToolTipText() == null) {
0331:                                            button
0332:                                                    .setToolTipText("This is a tool tip.");
0333:                                        } else {
0334:                                            button.setToolTipText(null);
0335:                                        }
0336:                                    }
0337:                                });
0338:                            }
0339:                        });
0340:                controlsColumn.addButton("Toggle Enabled State",
0341:                        new ActionListener() {
0342:                            public void actionPerformed(ActionEvent e) {
0343:                                apply(new Applicator() {
0344:                                    public void apply(AbstractButton button) {
0345:                                        button.setEnabled(!button.isEnabled());
0346:                                    }
0347:                                });
0348:                            }
0349:                        });
0350:                controlsColumn.addButton("Toggle Enabled State (Container)",
0351:                        new ActionListener() {
0352:                            public void actionPerformed(ActionEvent e) {
0353:                                testGrid.setEnabled(!testGrid.isEnabled());
0354:                            }
0355:                        });
0356:
0357:                controlsColumn = new ButtonColumn();
0358:                controlGroupsColumn.add(controlsColumn);
0359:
0360:                controlsColumn.add(new Label("AbstractButton Controls"));
0361:
0362:                // Base Settings
0363:                controlsColumn.addButton("Set Foreground",
0364:                        new ActionListener() {
0365:                            public void actionPerformed(ActionEvent e) {
0366:                                final Color color = StyleUtil.randomColor();
0367:                                apply(new Applicator() {
0368:                                    public void apply(AbstractButton button) {
0369:                                        button.setForeground(color);
0370:                                    }
0371:                                });
0372:                            }
0373:                        });
0374:                controlsColumn.addButton("Clear Foreground",
0375:                        new ActionListener() {
0376:                            public void actionPerformed(ActionEvent e) {
0377:                                apply(new Applicator() {
0378:                                    public void apply(AbstractButton button) {
0379:                                        button.setForeground(null);
0380:                                    }
0381:                                });
0382:                            }
0383:                        });
0384:                controlsColumn.addButton("Set Background",
0385:                        new ActionListener() {
0386:                            public void actionPerformed(ActionEvent e) {
0387:                                final Color color = StyleUtil.randomColor();
0388:                                apply(new Applicator() {
0389:                                    public void apply(AbstractButton button) {
0390:                                        button.setBackground(color);
0391:                                    }
0392:                                });
0393:                            }
0394:                        });
0395:                controlsColumn.addButton("Clear Background",
0396:                        new ActionListener() {
0397:                            public void actionPerformed(ActionEvent e) {
0398:                                apply(new Applicator() {
0399:                                    public void apply(AbstractButton button) {
0400:                                        button.setBackground(null);
0401:                                    }
0402:                                });
0403:                            }
0404:                        });
0405:                controlsColumn.addButton("Set Font", new ActionListener() {
0406:                    public void actionPerformed(ActionEvent e) {
0407:                        final Font font = StyleUtil.randomFont();
0408:                        apply(new Applicator() {
0409:                            public void apply(AbstractButton button) {
0410:                                button.setFont(font);
0411:                            }
0412:                        });
0413:                    }
0414:                });
0415:                controlsColumn.addButton("Clear Font", new ActionListener() {
0416:                    public void actionPerformed(ActionEvent e) {
0417:                        apply(new Applicator() {
0418:                            public void apply(AbstractButton button) {
0419:                                button.setFont(null);
0420:                            }
0421:                        });
0422:                    }
0423:                });
0424:                controlsColumn.addButton("Set Background Image",
0425:                        new ActionListener() {
0426:                            public void actionPerformed(ActionEvent e) {
0427:                                apply(new Applicator() {
0428:                                    public void apply(AbstractButton button) {
0429:                                        button
0430:                                                .setBackgroundImage(Styles.BUTTON_BACKGROUND_IMAGE);
0431:                                    }
0432:                                });
0433:                            }
0434:                        });
0435:                controlsColumn.addButton("Clear Background Image",
0436:                        new ActionListener() {
0437:                            public void actionPerformed(ActionEvent e) {
0438:                                apply(new Applicator() {
0439:                                    public void apply(AbstractButton button) {
0440:                                        button.setBackgroundImage(null);
0441:                                    }
0442:                                });
0443:                            }
0444:                        });
0445:                controlsColumn.addButton("Set Line Wrap = true",
0446:                        new ActionListener() {
0447:                            public void actionPerformed(ActionEvent e) {
0448:                                apply(new Applicator() {
0449:                                    public void apply(AbstractButton button) {
0450:                                        button.setLineWrap(true);
0451:                                    }
0452:                                });
0453:                            }
0454:                        });
0455:                controlsColumn.addButton("Set Line Wrap = false",
0456:                        new ActionListener() {
0457:                            public void actionPerformed(ActionEvent e) {
0458:                                apply(new Applicator() {
0459:                                    public void apply(AbstractButton button) {
0460:                                        button.setLineWrap(false);
0461:                                    }
0462:                                });
0463:                            }
0464:                        });
0465:                controlsColumn.addButton("Set Width = Default",
0466:                        new ActionListener() {
0467:                            public void actionPerformed(ActionEvent e) {
0468:                                apply(new Applicator() {
0469:                                    public void apply(AbstractButton button) {
0470:                                        button.setWidth(null);
0471:                                    }
0472:                                });
0473:                            }
0474:                        });
0475:                controlsColumn.addButton("Set Width = 300px",
0476:                        new ActionListener() {
0477:                            public void actionPerformed(ActionEvent e) {
0478:                                apply(new Applicator() {
0479:                                    public void apply(AbstractButton button) {
0480:                                        button.setWidth(new Extent(300,
0481:                                                Extent.PX));
0482:                                    }
0483:                                });
0484:                            }
0485:                        });
0486:                controlsColumn.addButton("Set Width = 50%",
0487:                        new ActionListener() {
0488:                            public void actionPerformed(ActionEvent e) {
0489:                                apply(new Applicator() {
0490:                                    public void apply(AbstractButton button) {
0491:                                        button.setWidth(new Extent(50,
0492:                                                Extent.PERCENT));
0493:                                    }
0494:                                });
0495:                            }
0496:                        });
0497:                controlsColumn.addButton("Set Height = Default",
0498:                        new ActionListener() {
0499:                            public void actionPerformed(ActionEvent e) {
0500:                                apply(new Applicator() {
0501:                                    public void apply(AbstractButton button) {
0502:                                        button.setHeight(null);
0503:                                    }
0504:                                });
0505:                            }
0506:                        });
0507:                controlsColumn.addButton("Set Height = 100px",
0508:                        new ActionListener() {
0509:                            public void actionPerformed(ActionEvent e) {
0510:                                apply(new Applicator() {
0511:                                    public void apply(AbstractButton button) {
0512:                                        button.setHeight(new Extent(100,
0513:                                                Extent.PX));
0514:                                    }
0515:                                });
0516:                            }
0517:                        });
0518:                controlsColumn.addButton("Set Insets = Default",
0519:                        new ActionListener() {
0520:                            public void actionPerformed(ActionEvent e) {
0521:                                apply(new Applicator() {
0522:                                    public void apply(AbstractButton button) {
0523:                                        button.setInsets(null);
0524:                                    }
0525:                                });
0526:                            }
0527:                        });
0528:                controlsColumn.addButton("Set Insets = 10/5px",
0529:                        new ActionListener() {
0530:                            public void actionPerformed(ActionEvent e) {
0531:                                apply(new Applicator() {
0532:                                    public void apply(AbstractButton button) {
0533:                                        button.setInsets(new Insets(10, 5));
0534:                                    }
0535:                                });
0536:                            }
0537:                        });
0538:                controlsColumn.addButton("Set Insets = 30px",
0539:                        new ActionListener() {
0540:                            public void actionPerformed(ActionEvent e) {
0541:                                apply(new Applicator() {
0542:                                    public void apply(AbstractButton button) {
0543:                                        button.setInsets(new Insets(30, 30));
0544:                                    }
0545:                                });
0546:                            }
0547:                        });
0548:
0549:                // Rollover Effect Settings
0550:
0551:                controlsColumn = new ButtonColumn();
0552:                controlGroupsColumn.add(controlsColumn);
0553:
0554:                controlsColumn.add(new Label("Rollover Effects"));
0555:
0556:                controlsColumn.addButton("Enable Rollover Effects",
0557:                        new ActionListener() {
0558:                            public void actionPerformed(ActionEvent e) {
0559:                                apply(new Applicator() {
0560:                                    public void apply(AbstractButton button) {
0561:                                        button.setRolloverEnabled(true);
0562:                                    }
0563:                                });
0564:                            }
0565:                        });
0566:                controlsColumn.addButton("Disable Rollover Effects",
0567:                        new ActionListener() {
0568:                            public void actionPerformed(ActionEvent e) {
0569:                                apply(new Applicator() {
0570:                                    public void apply(AbstractButton button) {
0571:                                        button.setRolloverEnabled(false);
0572:                                    }
0573:                                });
0574:                            }
0575:                        });
0576:                controlsColumn.addButton("Set Rollover Icon",
0577:                        new ActionListener() {
0578:                            public void actionPerformed(ActionEvent e) {
0579:                                apply(new Applicator() {
0580:                                    public void apply(AbstractButton button) {
0581:                                        if (button.getIcon() != null) {
0582:                                            button
0583:                                                    .setRolloverIcon(Styles.ROLLOVER_ICON_LOGO);
0584:                                        }
0585:                                    }
0586:                                });
0587:                            }
0588:                        });
0589:                controlsColumn.addButton("Clear Rollover Icon",
0590:                        new ActionListener() {
0591:                            public void actionPerformed(ActionEvent e) {
0592:                                apply(new Applicator() {
0593:                                    public void apply(AbstractButton button) {
0594:                                        if (button.getIcon() != null) {
0595:                                            button.setRolloverIcon(null);
0596:                                        }
0597:                                    }
0598:                                });
0599:                            }
0600:                        });
0601:                controlsColumn.addButton("Set Rollover Foreground",
0602:                        new ActionListener() {
0603:                            public void actionPerformed(ActionEvent e) {
0604:                                final Color color = StyleUtil.randomColor();
0605:                                apply(new Applicator() {
0606:                                    public void apply(AbstractButton button) {
0607:                                        button.setRolloverForeground(color);
0608:                                    }
0609:                                });
0610:                            }
0611:                        });
0612:                controlsColumn.addButton("Clear Rollover Foreground",
0613:                        new ActionListener() {
0614:                            public void actionPerformed(ActionEvent e) {
0615:                                apply(new Applicator() {
0616:                                    public void apply(AbstractButton button) {
0617:                                        button.setRolloverForeground(null);
0618:                                    }
0619:                                });
0620:                            }
0621:                        });
0622:                controlsColumn.addButton("Set Rollover Background",
0623:                        new ActionListener() {
0624:                            public void actionPerformed(ActionEvent e) {
0625:                                final Color color = StyleUtil.randomColor();
0626:                                apply(new Applicator() {
0627:                                    public void apply(AbstractButton button) {
0628:                                        button.setRolloverBackground(color);
0629:                                    }
0630:                                });
0631:                            }
0632:                        });
0633:                controlsColumn.addButton("Clear Rollover Background",
0634:                        new ActionListener() {
0635:                            public void actionPerformed(ActionEvent e) {
0636:                                apply(new Applicator() {
0637:                                    public void apply(AbstractButton button) {
0638:                                        button.setRolloverBackground(null);
0639:                                    }
0640:                                });
0641:                            }
0642:                        });
0643:                controlsColumn.addButton("Set Rollover Font",
0644:                        new ActionListener() {
0645:                            public void actionPerformed(ActionEvent e) {
0646:                                final Font font = StyleUtil.randomFont();
0647:                                apply(new Applicator() {
0648:                                    public void apply(AbstractButton button) {
0649:                                        button.setRolloverFont(font);
0650:                                    }
0651:                                });
0652:                            }
0653:                        });
0654:                controlsColumn.addButton("Clear Rollover Font",
0655:                        new ActionListener() {
0656:                            public void actionPerformed(ActionEvent e) {
0657:                                apply(new Applicator() {
0658:                                    public void apply(AbstractButton button) {
0659:                                        button.setRolloverFont(null);
0660:                                    }
0661:                                });
0662:                            }
0663:                        });
0664:                controlsColumn.addButton("Set Rollover Background Image",
0665:                        new ActionListener() {
0666:                            public void actionPerformed(ActionEvent e) {
0667:                                apply(new Applicator() {
0668:                                    public void apply(AbstractButton button) {
0669:                                        button
0670:                                                .setRolloverBackgroundImage(Styles.BUTTON_ROLLOVER_BACKGROUND_IMAGE);
0671:                                    }
0672:                                });
0673:                            }
0674:                        });
0675:                controlsColumn.addButton("Clear Rollover Background Image",
0676:                        new ActionListener() {
0677:                            public void actionPerformed(ActionEvent e) {
0678:                                apply(new Applicator() {
0679:                                    public void apply(AbstractButton button) {
0680:                                        button.setRolloverBackgroundImage(null);
0681:                                    }
0682:                                });
0683:                            }
0684:                        });
0685:
0686:                // Pressed Effect Settings
0687:
0688:                controlsColumn = new ButtonColumn();
0689:                controlGroupsColumn.add(controlsColumn);
0690:
0691:                controlsColumn.add(new Label("Pressed Effects"));
0692:
0693:                controlsColumn.addButton("Enable Pressed Effects",
0694:                        new ActionListener() {
0695:                            public void actionPerformed(ActionEvent e) {
0696:                                apply(new Applicator() {
0697:                                    public void apply(AbstractButton button) {
0698:                                        button.setPressedEnabled(true);
0699:                                    }
0700:                                });
0701:                            }
0702:                        });
0703:                controlsColumn.addButton("Disable Pressed Effects",
0704:                        new ActionListener() {
0705:                            public void actionPerformed(ActionEvent e) {
0706:                                apply(new Applicator() {
0707:                                    public void apply(AbstractButton button) {
0708:                                        button.setPressedEnabled(false);
0709:                                    }
0710:                                });
0711:                            }
0712:                        });
0713:                controlsColumn.addButton("Set Pressed Icon",
0714:                        new ActionListener() {
0715:                            public void actionPerformed(ActionEvent e) {
0716:                                apply(new Applicator() {
0717:                                    public void apply(AbstractButton button) {
0718:                                        if (button.getIcon() != null) {
0719:                                            button
0720:                                                    .setPressedIcon(Styles.PRESSED_ICON_LOGO);
0721:                                        }
0722:                                    }
0723:                                });
0724:                            }
0725:                        });
0726:                controlsColumn.addButton("Clear Pressed Icon",
0727:                        new ActionListener() {
0728:                            public void actionPerformed(ActionEvent e) {
0729:                                apply(new Applicator() {
0730:                                    public void apply(AbstractButton button) {
0731:                                        if (button.getIcon() != null) {
0732:                                            button.setPressedIcon(null);
0733:                                        }
0734:                                    }
0735:                                });
0736:                            }
0737:                        });
0738:                controlsColumn.addButton("Set Pressed Foreground",
0739:                        new ActionListener() {
0740:                            public void actionPerformed(ActionEvent e) {
0741:                                final Color color = StyleUtil.randomColor();
0742:                                apply(new Applicator() {
0743:                                    public void apply(AbstractButton button) {
0744:                                        button.setPressedForeground(color);
0745:                                    }
0746:                                });
0747:                            }
0748:                        });
0749:                controlsColumn.addButton("Clear Pressed Foreground",
0750:                        new ActionListener() {
0751:                            public void actionPerformed(ActionEvent e) {
0752:                                apply(new Applicator() {
0753:                                    public void apply(AbstractButton button) {
0754:                                        button.setPressedForeground(null);
0755:                                    }
0756:                                });
0757:                            }
0758:                        });
0759:                controlsColumn.addButton("Set Pressed Background",
0760:                        new ActionListener() {
0761:                            public void actionPerformed(ActionEvent e) {
0762:                                final Color color = StyleUtil.randomColor();
0763:                                apply(new Applicator() {
0764:                                    public void apply(AbstractButton button) {
0765:                                        button.setPressedBackground(color);
0766:                                    }
0767:                                });
0768:                            }
0769:                        });
0770:                controlsColumn.addButton("Clear Pressed Background",
0771:                        new ActionListener() {
0772:                            public void actionPerformed(ActionEvent e) {
0773:                                apply(new Applicator() {
0774:                                    public void apply(AbstractButton button) {
0775:                                        button.setPressedBackground(null);
0776:                                    }
0777:                                });
0778:                            }
0779:                        });
0780:                controlsColumn.addButton("Set Pressed Font",
0781:                        new ActionListener() {
0782:                            public void actionPerformed(ActionEvent e) {
0783:                                final Font font = StyleUtil.randomFont();
0784:                                apply(new Applicator() {
0785:                                    public void apply(AbstractButton button) {
0786:                                        button.setPressedFont(font);
0787:                                    }
0788:                                });
0789:                            }
0790:                        });
0791:                controlsColumn.addButton("Clear Pressed Font",
0792:                        new ActionListener() {
0793:                            public void actionPerformed(ActionEvent e) {
0794:                                apply(new Applicator() {
0795:                                    public void apply(AbstractButton button) {
0796:                                        button.setPressedFont(null);
0797:                                    }
0798:                                });
0799:                            }
0800:                        });
0801:                controlsColumn.addButton("Set Pressed Background Image",
0802:                        new ActionListener() {
0803:                            public void actionPerformed(ActionEvent e) {
0804:                                apply(new Applicator() {
0805:                                    public void apply(AbstractButton button) {
0806:                                        button
0807:                                                .setPressedBackgroundImage(Styles.BUTTON_PRESSED_BACKGROUND_IMAGE);
0808:                                    }
0809:                                });
0810:                            }
0811:                        });
0812:                controlsColumn.addButton("Clear Pressed Background Image",
0813:                        new ActionListener() {
0814:                            public void actionPerformed(ActionEvent e) {
0815:                                apply(new Applicator() {
0816:                                    public void apply(AbstractButton button) {
0817:                                        button.setPressedBackgroundImage(null);
0818:                                    }
0819:                                });
0820:                            }
0821:                        });
0822:
0823:                // Disabled Effect Settings
0824:
0825:                controlsColumn = new ButtonColumn();
0826:                controlGroupsColumn.add(controlsColumn);
0827:
0828:                controlsColumn.add(new Label("Disabled Effects"));
0829:
0830:                controlsColumn.addButton("Set Disabled Icon",
0831:                        new ActionListener() {
0832:                            public void actionPerformed(ActionEvent e) {
0833:                                apply(new Applicator() {
0834:                                    public void apply(AbstractButton button) {
0835:                                        if (button.getIcon() != null) {
0836:                                            button
0837:                                                    .setDisabledIcon(Styles.DISABLED_ICON_LOGO);
0838:                                        }
0839:                                    }
0840:                                });
0841:                            }
0842:                        });
0843:                controlsColumn.addButton("Clear Disabled Icon",
0844:                        new ActionListener() {
0845:                            public void actionPerformed(ActionEvent e) {
0846:                                apply(new Applicator() {
0847:                                    public void apply(AbstractButton button) {
0848:                                        if (button.getIcon() != null) {
0849:                                            button.setDisabledIcon(null);
0850:                                        }
0851:                                    }
0852:                                });
0853:                            }
0854:                        });
0855:                controlsColumn.addButton("Set Disabled Foreground",
0856:                        new ActionListener() {
0857:                            public void actionPerformed(ActionEvent e) {
0858:                                final Color color = StyleUtil.randomColor();
0859:                                apply(new Applicator() {
0860:                                    public void apply(AbstractButton button) {
0861:                                        button.setDisabledForeground(color);
0862:                                    }
0863:                                });
0864:                            }
0865:                        });
0866:                controlsColumn.addButton("Clear Disabled Foreground",
0867:                        new ActionListener() {
0868:                            public void actionPerformed(ActionEvent e) {
0869:                                apply(new Applicator() {
0870:                                    public void apply(AbstractButton button) {
0871:                                        button.setDisabledForeground(null);
0872:                                    }
0873:                                });
0874:                            }
0875:                        });
0876:                controlsColumn.addButton("Set Disabled Background",
0877:                        new ActionListener() {
0878:                            public void actionPerformed(ActionEvent e) {
0879:                                final Color color = StyleUtil.randomColor();
0880:                                apply(new Applicator() {
0881:                                    public void apply(AbstractButton button) {
0882:                                        button.setDisabledBackground(color);
0883:                                    }
0884:                                });
0885:                            }
0886:                        });
0887:                controlsColumn.addButton("Clear Disabled Background",
0888:                        new ActionListener() {
0889:                            public void actionPerformed(ActionEvent e) {
0890:                                apply(new Applicator() {
0891:                                    public void apply(AbstractButton button) {
0892:                                        button.setDisabledBackground(null);
0893:                                    }
0894:                                });
0895:                            }
0896:                        });
0897:                controlsColumn.addButton("Set Disabled Font",
0898:                        new ActionListener() {
0899:                            public void actionPerformed(ActionEvent e) {
0900:                                final Font font = StyleUtil.randomFont();
0901:                                apply(new Applicator() {
0902:                                    public void apply(AbstractButton button) {
0903:                                        button.setDisabledFont(font);
0904:                                    }
0905:                                });
0906:                            }
0907:                        });
0908:                controlsColumn.addButton("Clear Disabled Font",
0909:                        new ActionListener() {
0910:                            public void actionPerformed(ActionEvent e) {
0911:                                apply(new Applicator() {
0912:                                    public void apply(AbstractButton button) {
0913:                                        button.setDisabledFont(null);
0914:                                    }
0915:                                });
0916:                            }
0917:                        });
0918:                controlsColumn.addButton("Set Disabled Background Image",
0919:                        new ActionListener() {
0920:                            public void actionPerformed(ActionEvent e) {
0921:                                apply(new Applicator() {
0922:                                    public void apply(AbstractButton button) {
0923:                                        button
0924:                                                .setDisabledBackgroundImage(Styles.BUTTON_DISABLED_BACKGROUND_IMAGE);
0925:                                    }
0926:                                });
0927:                            }
0928:                        });
0929:                controlsColumn.addButton("Clear Disabled Background Image",
0930:                        new ActionListener() {
0931:                            public void actionPerformed(ActionEvent e) {
0932:                                apply(new Applicator() {
0933:                                    public void apply(AbstractButton button) {
0934:                                        button.setDisabledBackgroundImage(null);
0935:                                    }
0936:                                });
0937:                            }
0938:                        });
0939:
0940:                // Text Position
0941:
0942:                controlsColumn = new ButtonColumn();
0943:                controlGroupsColumn.add(controlsColumn);
0944:
0945:                controlsColumn.add(new Label("Text Position"));
0946:
0947:                controlsColumn.addButton("TextPosition = Default",
0948:                        new ActionListener() {
0949:                            public void actionPerformed(ActionEvent e) {
0950:                                apply(new Applicator() {
0951:                                    public void apply(AbstractButton button) {
0952:                                        button.setTextPosition(null);
0953:                                    }
0954:                                });
0955:                            }
0956:                        });
0957:                controlsColumn.addButton("TextPosition = Top",
0958:                        new ActionListener() {
0959:                            public void actionPerformed(ActionEvent e) {
0960:                                apply(new Applicator() {
0961:                                    public void apply(AbstractButton button) {
0962:                                        button.setTextPosition(new Alignment(
0963:                                                Alignment.DEFAULT,
0964:                                                Alignment.TOP));
0965:                                    }
0966:                                });
0967:                            }
0968:                        });
0969:                controlsColumn.addButton("TextPosition = Bottom",
0970:                        new ActionListener() {
0971:                            public void actionPerformed(ActionEvent e) {
0972:                                apply(new Applicator() {
0973:                                    public void apply(AbstractButton button) {
0974:                                        button.setTextPosition(new Alignment(
0975:                                                Alignment.DEFAULT,
0976:                                                Alignment.BOTTOM));
0977:                                    }
0978:                                });
0979:                            }
0980:                        });
0981:                controlsColumn.addButton("TextPosition = Left",
0982:                        new ActionListener() {
0983:                            public void actionPerformed(ActionEvent e) {
0984:                                apply(new Applicator() {
0985:                                    public void apply(AbstractButton button) {
0986:                                        button.setTextPosition(new Alignment(
0987:                                                Alignment.LEFT,
0988:                                                Alignment.DEFAULT));
0989:                                    }
0990:                                });
0991:                            }
0992:                        });
0993:                controlsColumn.addButton("TextPosition = Right",
0994:                        new ActionListener() {
0995:                            public void actionPerformed(ActionEvent e) {
0996:                                apply(new Applicator() {
0997:                                    public void apply(AbstractButton button) {
0998:                                        button.setTextPosition(new Alignment(
0999:                                                Alignment.RIGHT,
1000:                                                Alignment.DEFAULT));
1001:                                    }
1002:                                });
1003:                            }
1004:                        });
1005:                controlsColumn.addButton("TextPosition = Leading",
1006:                        new ActionListener() {
1007:                            public void actionPerformed(ActionEvent e) {
1008:                                apply(new Applicator() {
1009:                                    public void apply(AbstractButton button) {
1010:                                        button.setTextPosition(new Alignment(
1011:                                                Alignment.LEADING,
1012:                                                Alignment.DEFAULT));
1013:                                    }
1014:                                });
1015:                            }
1016:                        });
1017:                controlsColumn.addButton("TextPosition = Trailing",
1018:                        new ActionListener() {
1019:                            public void actionPerformed(ActionEvent e) {
1020:                                apply(new Applicator() {
1021:                                    public void apply(AbstractButton button) {
1022:                                        button.setTextPosition(new Alignment(
1023:                                                Alignment.TRAILING,
1024:                                                Alignment.DEFAULT));
1025:                                    }
1026:                                });
1027:                            }
1028:                        });
1029:
1030:                // Text Alignment
1031:
1032:                controlsColumn = new ButtonColumn();
1033:                controlGroupsColumn.add(controlsColumn);
1034:
1035:                controlsColumn.add(new Label("Text Alignment"));
1036:
1037:                controlsColumn.addButton("TextAlignment = Default",
1038:                        new ActionListener() {
1039:                            public void actionPerformed(ActionEvent e) {
1040:                                apply(new Applicator() {
1041:                                    public void apply(AbstractButton button) {
1042:                                        button.setTextAlignment(null);
1043:                                    }
1044:                                });
1045:                            }
1046:                        });
1047:                controlsColumn.addButton("TextAlignment = Top",
1048:                        new ActionListener() {
1049:                            public void actionPerformed(ActionEvent e) {
1050:                                apply(new Applicator() {
1051:                                    public void apply(AbstractButton button) {
1052:                                        button.setTextAlignment(new Alignment(
1053:                                                Alignment.DEFAULT,
1054:                                                Alignment.TOP));
1055:                                    }
1056:                                });
1057:                            }
1058:                        });
1059:                controlsColumn.addButton("TextAlignment = Center (V)",
1060:                        new ActionListener() {
1061:                            public void actionPerformed(ActionEvent e) {
1062:                                apply(new Applicator() {
1063:                                    public void apply(AbstractButton button) {
1064:                                        button.setTextAlignment(new Alignment(
1065:                                                Alignment.DEFAULT,
1066:                                                Alignment.CENTER));
1067:                                    }
1068:                                });
1069:                            }
1070:                        });
1071:                controlsColumn.addButton("TextAlignment = Bottom",
1072:                        new ActionListener() {
1073:                            public void actionPerformed(ActionEvent e) {
1074:                                apply(new Applicator() {
1075:                                    public void apply(AbstractButton button) {
1076:                                        button.setTextAlignment(new Alignment(
1077:                                                Alignment.DEFAULT,
1078:                                                Alignment.BOTTOM));
1079:                                    }
1080:                                });
1081:                            }
1082:                        });
1083:                controlsColumn.addButton("TextAlignment = Left",
1084:                        new ActionListener() {
1085:                            public void actionPerformed(ActionEvent e) {
1086:                                apply(new Applicator() {
1087:                                    public void apply(AbstractButton button) {
1088:                                        button.setTextAlignment(new Alignment(
1089:                                                Alignment.LEFT,
1090:                                                Alignment.DEFAULT));
1091:                                    }
1092:                                });
1093:                            }
1094:                        });
1095:                controlsColumn.addButton("TextAlignment = Center (H)",
1096:                        new ActionListener() {
1097:                            public void actionPerformed(ActionEvent e) {
1098:                                apply(new Applicator() {
1099:                                    public void apply(AbstractButton button) {
1100:                                        button.setTextAlignment(new Alignment(
1101:                                                Alignment.CENTER,
1102:                                                Alignment.DEFAULT));
1103:                                    }
1104:                                });
1105:                            }
1106:                        });
1107:                controlsColumn.addButton("TextAlignment = Right",
1108:                        new ActionListener() {
1109:                            public void actionPerformed(ActionEvent e) {
1110:                                apply(new Applicator() {
1111:                                    public void apply(AbstractButton button) {
1112:                                        button.setTextAlignment(new Alignment(
1113:                                                Alignment.RIGHT,
1114:                                                Alignment.DEFAULT));
1115:                                    }
1116:                                });
1117:                            }
1118:                        });
1119:                controlsColumn.addButton("TextAlignment = Leading",
1120:                        new ActionListener() {
1121:                            public void actionPerformed(ActionEvent e) {
1122:                                apply(new Applicator() {
1123:                                    public void apply(AbstractButton button) {
1124:                                        button.setTextAlignment(new Alignment(
1125:                                                Alignment.LEADING,
1126:                                                Alignment.DEFAULT));
1127:                                    }
1128:                                });
1129:                            }
1130:                        });
1131:                controlsColumn.addButton("TextAlignment = Trailing",
1132:                        new ActionListener() {
1133:                            public void actionPerformed(ActionEvent e) {
1134:                                apply(new Applicator() {
1135:                                    public void apply(AbstractButton button) {
1136:                                        button.setTextAlignment(new Alignment(
1137:                                                Alignment.TRAILING,
1138:                                                Alignment.DEFAULT));
1139:                                    }
1140:                                });
1141:                            }
1142:                        });
1143:
1144:                // Alignment
1145:
1146:                controlsColumn = new ButtonColumn();
1147:                controlGroupsColumn.add(controlsColumn);
1148:
1149:                controlsColumn.add(new Label("Alignment"));
1150:
1151:                controlsColumn.addButton("Alignment = Default",
1152:                        new ActionListener() {
1153:                            public void actionPerformed(ActionEvent e) {
1154:                                apply(new Applicator() {
1155:                                    public void apply(AbstractButton button) {
1156:                                        button.setAlignment(null);
1157:                                    }
1158:                                });
1159:                            }
1160:                        });
1161:                controlsColumn.addButton("Alignment = Left",
1162:                        new ActionListener() {
1163:                            public void actionPerformed(ActionEvent e) {
1164:                                apply(new Applicator() {
1165:                                    public void apply(AbstractButton button) {
1166:                                        button.setAlignment(new Alignment(
1167:                                                Alignment.LEFT,
1168:                                                Alignment.DEFAULT));
1169:                                    }
1170:                                });
1171:                            }
1172:                        });
1173:                controlsColumn.addButton("Alignment = Center (H)",
1174:                        new ActionListener() {
1175:                            public void actionPerformed(ActionEvent e) {
1176:                                apply(new Applicator() {
1177:                                    public void apply(AbstractButton button) {
1178:                                        button.setAlignment(new Alignment(
1179:                                                Alignment.CENTER,
1180:                                                Alignment.DEFAULT));
1181:                                    }
1182:                                });
1183:                            }
1184:                        });
1185:                controlsColumn.addButton("Alignment = Right",
1186:                        new ActionListener() {
1187:                            public void actionPerformed(ActionEvent e) {
1188:                                apply(new Applicator() {
1189:                                    public void apply(AbstractButton button) {
1190:                                        button.setAlignment(new Alignment(
1191:                                                Alignment.RIGHT,
1192:                                                Alignment.DEFAULT));
1193:                                    }
1194:                                });
1195:                            }
1196:                        });
1197:                controlsColumn.addButton("Alignment = Leading",
1198:                        new ActionListener() {
1199:                            public void actionPerformed(ActionEvent e) {
1200:                                apply(new Applicator() {
1201:                                    public void apply(AbstractButton button) {
1202:                                        button.setAlignment(new Alignment(
1203:                                                Alignment.LEADING,
1204:                                                Alignment.DEFAULT));
1205:                                    }
1206:                                });
1207:                            }
1208:                        });
1209:                controlsColumn.addButton("Alignment = Trailing",
1210:                        new ActionListener() {
1211:                            public void actionPerformed(ActionEvent e) {
1212:                                apply(new Applicator() {
1213:                                    public void apply(AbstractButton button) {
1214:                                        button.setAlignment(new Alignment(
1215:                                                Alignment.TRAILING,
1216:                                                Alignment.DEFAULT));
1217:                                    }
1218:                                });
1219:                            }
1220:                        });
1221:
1222:                // Icon/Text Margin
1223:
1224:                controlsColumn = new ButtonColumn();
1225:                controlGroupsColumn.add(controlsColumn);
1226:
1227:                controlsColumn.add(new Label("Icon/Text Margin"));
1228:
1229:                controlsColumn.addButton("IconTextMargin = default",
1230:                        new ActionListener() {
1231:                            public void actionPerformed(ActionEvent e) {
1232:                                apply(new Applicator() {
1233:                                    public void apply(AbstractButton button) {
1234:                                        button.setIconTextMargin(null);
1235:                                    }
1236:                                });
1237:                            }
1238:                        });
1239:                controlsColumn.addButton("IconTextMargin = 0px",
1240:                        new ActionListener() {
1241:                            public void actionPerformed(ActionEvent e) {
1242:                                apply(new Applicator() {
1243:                                    public void apply(AbstractButton button) {
1244:                                        button.setIconTextMargin(new Extent(0));
1245:                                    }
1246:                                });
1247:                            }
1248:                        });
1249:                controlsColumn.addButton("IconTextMargin = 1px",
1250:                        new ActionListener() {
1251:                            public void actionPerformed(ActionEvent e) {
1252:                                apply(new Applicator() {
1253:                                    public void apply(AbstractButton button) {
1254:                                        button.setIconTextMargin(new Extent(1));
1255:                                    }
1256:                                });
1257:                            }
1258:                        });
1259:                controlsColumn.addButton("IconTextMargin = 2px",
1260:                        new ActionListener() {
1261:                            public void actionPerformed(ActionEvent e) {
1262:                                apply(new Applicator() {
1263:                                    public void apply(AbstractButton button) {
1264:                                        button.setIconTextMargin(new Extent(2));
1265:                                    }
1266:                                });
1267:                            }
1268:                        });
1269:                controlsColumn.addButton("IconTextMargin = 10px",
1270:                        new ActionListener() {
1271:                            public void actionPerformed(ActionEvent e) {
1272:                                apply(new Applicator() {
1273:                                    public void apply(AbstractButton button) {
1274:                                        button
1275:                                                .setIconTextMargin(new Extent(
1276:                                                        10));
1277:                                    }
1278:                                });
1279:                            }
1280:                        });
1281:                controlsColumn.addButton("IconTextMargin = 1in",
1282:                        new ActionListener() {
1283:                            public void actionPerformed(ActionEvent e) {
1284:                                apply(new Applicator() {
1285:                                    public void apply(AbstractButton button) {
1286:                                        button.setIconTextMargin(new Extent(1,
1287:                                                Extent.IN));
1288:                                    }
1289:                                });
1290:                            }
1291:                        });
1292:
1293:                // Create 'ToggleButton Controls Group'
1294:
1295:                controlsColumn = new ButtonColumn();
1296:                controlGroupsColumn.add(controlsColumn);
1297:
1298:                controlsColumn.add(new Label("General ToggleButton Controls"));
1299:
1300:                controlsColumn.addButton("Selected = False",
1301:                        new ActionListener() {
1302:                            public void actionPerformed(ActionEvent e) {
1303:                                apply(new Applicator() {
1304:                                    public void apply(AbstractButton button) {
1305:                                        if (button instanceof  ToggleButton) {
1306:                                            ((ToggleButton) button)
1307:                                                    .setSelected(false);
1308:                                        }
1309:                                    }
1310:                                });
1311:                            }
1312:                        });
1313:                controlsColumn.addButton("Selected = True",
1314:                        new ActionListener() {
1315:                            public void actionPerformed(ActionEvent e) {
1316:                                apply(new Applicator() {
1317:                                    public void apply(AbstractButton button) {
1318:                                        if (button instanceof  ToggleButton) {
1319:                                            ((ToggleButton) button)
1320:                                                    .setSelected(true);
1321:                                        }
1322:                                    }
1323:                                });
1324:                            }
1325:                        });
1326:                controlsColumn.addButton("Set Custom State Icons",
1327:                        new ActionListener() {
1328:                            public void actionPerformed(ActionEvent e) {
1329:                                apply(new Applicator() {
1330:                                    public void apply(AbstractButton button) {
1331:                                        if (button instanceof  ToggleButton) {
1332:                                            ToggleButton toggleButton = (ToggleButton) button;
1333:                                            toggleButton
1334:                                                    .setStateIcon(Styles.RG_STATE_ICON);
1335:                                            toggleButton
1336:                                                    .setSelectedStateIcon(Styles.RG_SELECTED_STATE_ICON);
1337:                                            toggleButton
1338:                                                    .setPressedStateIcon(Styles.RG_PRESSED_STATE_ICON);
1339:                                            toggleButton
1340:                                                    .setPressedSelectedStateIcon(Styles.RG_PRESSED_SELECTED_STATE_ICON);
1341:                                            toggleButton
1342:                                                    .setRolloverStateIcon(Styles.RG_ROLLOVER_STATE_ICON);
1343:                                            toggleButton
1344:                                                    .setRolloverSelectedStateIcon(Styles.RG_ROLLOVER_SELECTED_STATE_ICON);
1345:                                        }
1346:                                    }
1347:                                });
1348:                            }
1349:                        });
1350:                controlsColumn.addButton("Clear Custom State Icons",
1351:                        new ActionListener() {
1352:                            public void actionPerformed(ActionEvent e) {
1353:                                apply(new Applicator() {
1354:                                    public void apply(AbstractButton button) {
1355:                                        if (button instanceof  ToggleButton) {
1356:                                            ToggleButton toggleButton = (ToggleButton) button;
1357:                                            toggleButton.setStateIcon(null);
1358:                                            toggleButton
1359:                                                    .setSelectedStateIcon(null);
1360:                                            toggleButton
1361:                                                    .setPressedStateIcon(null);
1362:                                            toggleButton
1363:                                                    .setPressedSelectedStateIcon(null);
1364:                                            toggleButton
1365:                                                    .setRolloverStateIcon(null);
1366:                                            toggleButton
1367:                                                    .setRolloverSelectedStateIcon(null);
1368:                                        }
1369:                                    }
1370:                                });
1371:                            }
1372:                        });
1373:
1374:                // ToggleButton State Position
1375:
1376:                controlsColumn = new ButtonColumn();
1377:                controlGroupsColumn.add(controlsColumn);
1378:
1379:                controlsColumn.add(new Label("ToggleButton State Position"));
1380:
1381:                controlsColumn.addButton("StatePosition = Default",
1382:                        new ActionListener() {
1383:                            public void actionPerformed(ActionEvent e) {
1384:                                apply(new Applicator() {
1385:                                    public void apply(AbstractButton button) {
1386:                                        if (button instanceof  ToggleButton) {
1387:                                            ((ToggleButton) button)
1388:                                                    .setStatePosition(null);
1389:                                        }
1390:                                    }
1391:                                });
1392:                            }
1393:                        });
1394:                controlsColumn.addButton("StatePosition = Top",
1395:                        new ActionListener() {
1396:                            public void actionPerformed(ActionEvent e) {
1397:                                apply(new Applicator() {
1398:                                    public void apply(AbstractButton button) {
1399:                                        if (button instanceof  ToggleButton) {
1400:                                            ((ToggleButton) button)
1401:                                                    .setStatePosition(new Alignment(
1402:                                                            Alignment.DEFAULT,
1403:                                                            Alignment.TOP));
1404:                                        }
1405:                                    }
1406:                                });
1407:                            }
1408:                        });
1409:                controlsColumn.addButton("StatePosition = Bottom",
1410:                        new ActionListener() {
1411:                            public void actionPerformed(ActionEvent e) {
1412:                                apply(new Applicator() {
1413:                                    public void apply(AbstractButton button) {
1414:                                        if (button instanceof  ToggleButton) {
1415:                                            ((ToggleButton) button)
1416:                                                    .setStatePosition(new Alignment(
1417:                                                            Alignment.DEFAULT,
1418:                                                            Alignment.BOTTOM));
1419:                                        }
1420:                                    }
1421:                                });
1422:                            }
1423:                        });
1424:                controlsColumn.addButton("StatePosition = Left",
1425:                        new ActionListener() {
1426:                            public void actionPerformed(ActionEvent e) {
1427:                                apply(new Applicator() {
1428:                                    public void apply(AbstractButton button) {
1429:                                        if (button instanceof  ToggleButton) {
1430:                                            ((ToggleButton) button)
1431:                                                    .setStatePosition(new Alignment(
1432:                                                            Alignment.LEFT,
1433:                                                            Alignment.DEFAULT));
1434:                                        }
1435:                                    }
1436:                                });
1437:                            }
1438:                        });
1439:                controlsColumn.addButton("StatePosition = Right",
1440:                        new ActionListener() {
1441:                            public void actionPerformed(ActionEvent e) {
1442:                                apply(new Applicator() {
1443:                                    public void apply(AbstractButton button) {
1444:                                        if (button instanceof  ToggleButton) {
1445:                                            ((ToggleButton) button)
1446:                                                    .setStatePosition(new Alignment(
1447:                                                            Alignment.RIGHT,
1448:                                                            Alignment.DEFAULT));
1449:                                        }
1450:                                    }
1451:                                });
1452:                            }
1453:                        });
1454:                controlsColumn.addButton("StatePosition = Leading",
1455:                        new ActionListener() {
1456:                            public void actionPerformed(ActionEvent e) {
1457:                                apply(new Applicator() {
1458:                                    public void apply(AbstractButton button) {
1459:                                        if (button instanceof  ToggleButton) {
1460:                                            ((ToggleButton) button)
1461:                                                    .setStatePosition(new Alignment(
1462:                                                            Alignment.LEADING,
1463:                                                            Alignment.DEFAULT));
1464:                                        }
1465:                                    }
1466:                                });
1467:                            }
1468:                        });
1469:                controlsColumn.addButton("StatePosition = Trailing",
1470:                        new ActionListener() {
1471:                            public void actionPerformed(ActionEvent e) {
1472:                                apply(new Applicator() {
1473:                                    public void apply(AbstractButton button) {
1474:                                        if (button instanceof  ToggleButton) {
1475:                                            ((ToggleButton) button)
1476:                                                    .setStatePosition(new Alignment(
1477:                                                            Alignment.TRAILING,
1478:                                                            Alignment.DEFAULT));
1479:                                        }
1480:                                    }
1481:                                });
1482:                            }
1483:                        });
1484:
1485:                // ToggleButton State Alignment
1486:
1487:                controlsColumn = new ButtonColumn();
1488:                controlGroupsColumn.add(controlsColumn);
1489:
1490:                controlsColumn.add(new Label("ToggleButton State Alignment"));
1491:
1492:                controlsColumn.addButton("StateAlignment = Default",
1493:                        new ActionListener() {
1494:                            public void actionPerformed(ActionEvent e) {
1495:                                apply(new Applicator() {
1496:                                    public void apply(AbstractButton button) {
1497:                                        if (button instanceof  ToggleButton) {
1498:                                            ((ToggleButton) button)
1499:                                                    .setStateAlignment(null);
1500:                                        }
1501:                                    }
1502:                                });
1503:                            }
1504:                        });
1505:                controlsColumn.addButton("StateAlignment = Top",
1506:                        new ActionListener() {
1507:                            public void actionPerformed(ActionEvent e) {
1508:                                apply(new Applicator() {
1509:                                    public void apply(AbstractButton button) {
1510:                                        if (button instanceof  ToggleButton) {
1511:                                            ((ToggleButton) button)
1512:                                                    .setStateAlignment(new Alignment(
1513:                                                            Alignment.DEFAULT,
1514:                                                            Alignment.TOP));
1515:                                        }
1516:                                    }
1517:                                });
1518:                            }
1519:                        });
1520:                controlsColumn.addButton("StateAlignment = Center (V)",
1521:                        new ActionListener() {
1522:                            public void actionPerformed(ActionEvent e) {
1523:                                apply(new Applicator() {
1524:                                    public void apply(AbstractButton button) {
1525:                                        if (button instanceof  ToggleButton) {
1526:                                            ((ToggleButton) button)
1527:                                                    .setStateAlignment(new Alignment(
1528:                                                            Alignment.DEFAULT,
1529:                                                            Alignment.CENTER));
1530:                                        }
1531:                                    }
1532:                                });
1533:                            }
1534:                        });
1535:                controlsColumn.addButton("StateAlignment = Bottom",
1536:                        new ActionListener() {
1537:                            public void actionPerformed(ActionEvent e) {
1538:                                apply(new Applicator() {
1539:                                    public void apply(AbstractButton button) {
1540:                                        if (button instanceof  ToggleButton) {
1541:                                            ((ToggleButton) button)
1542:                                                    .setStateAlignment(new Alignment(
1543:                                                            Alignment.DEFAULT,
1544:                                                            Alignment.BOTTOM));
1545:                                        }
1546:                                    }
1547:                                });
1548:                            }
1549:                        });
1550:                controlsColumn.addButton("StateAlignment = Left",
1551:                        new ActionListener() {
1552:                            public void actionPerformed(ActionEvent e) {
1553:                                apply(new Applicator() {
1554:                                    public void apply(AbstractButton button) {
1555:                                        if (button instanceof  ToggleButton) {
1556:                                            ((ToggleButton) button)
1557:                                                    .setStateAlignment(new Alignment(
1558:                                                            Alignment.LEFT,
1559:                                                            Alignment.DEFAULT));
1560:                                        }
1561:                                    }
1562:                                });
1563:                            }
1564:                        });
1565:                controlsColumn.addButton("StateAlignment = Center (H)",
1566:                        new ActionListener() {
1567:                            public void actionPerformed(ActionEvent e) {
1568:                                apply(new Applicator() {
1569:                                    public void apply(AbstractButton button) {
1570:                                        if (button instanceof  ToggleButton) {
1571:                                            ((ToggleButton) button)
1572:                                                    .setStateAlignment(new Alignment(
1573:                                                            Alignment.CENTER,
1574:                                                            Alignment.DEFAULT));
1575:                                        }
1576:                                    }
1577:                                });
1578:                            }
1579:                        });
1580:                controlsColumn.addButton("StateAlignment = Right",
1581:                        new ActionListener() {
1582:                            public void actionPerformed(ActionEvent e) {
1583:                                apply(new Applicator() {
1584:                                    public void apply(AbstractButton button) {
1585:                                        if (button instanceof  ToggleButton) {
1586:                                            ((ToggleButton) button)
1587:                                                    .setStateAlignment(new Alignment(
1588:                                                            Alignment.RIGHT,
1589:                                                            Alignment.DEFAULT));
1590:                                        }
1591:                                    }
1592:                                });
1593:                            }
1594:                        });
1595:                controlsColumn.addButton("StateAlignment = Leading",
1596:                        new ActionListener() {
1597:                            public void actionPerformed(ActionEvent e) {
1598:                                apply(new Applicator() {
1599:                                    public void apply(AbstractButton button) {
1600:                                        if (button instanceof  ToggleButton) {
1601:                                            ((ToggleButton) button)
1602:                                                    .setStateAlignment(new Alignment(
1603:                                                            Alignment.LEADING,
1604:                                                            Alignment.DEFAULT));
1605:                                        }
1606:                                    }
1607:                                });
1608:                            }
1609:                        });
1610:                controlsColumn.addButton("StateAlignment = Trailing",
1611:                        new ActionListener() {
1612:                            public void actionPerformed(ActionEvent e) {
1613:                                apply(new Applicator() {
1614:                                    public void apply(AbstractButton button) {
1615:                                        if (button instanceof  ToggleButton) {
1616:                                            ((ToggleButton) button)
1617:                                                    .setStateAlignment(new Alignment(
1618:                                                            Alignment.TRAILING,
1619:                                                            Alignment.DEFAULT));
1620:                                        }
1621:                                    }
1622:                                });
1623:                            }
1624:                        });
1625:
1626:                // State Margin
1627:
1628:                controlsColumn = new ButtonColumn();
1629:                controlGroupsColumn.add(controlsColumn);
1630:
1631:                controlsColumn.add(new Label("State Margin"));
1632:
1633:                controlsColumn.addButton("StateMargin = default",
1634:                        new ActionListener() {
1635:                            public void actionPerformed(ActionEvent e) {
1636:                                apply(new Applicator() {
1637:                                    public void apply(AbstractButton button) {
1638:                                        if (button instanceof  ToggleButton) {
1639:                                            ((ToggleButton) button)
1640:                                                    .setStateMargin(null);
1641:                                        }
1642:                                    }
1643:                                });
1644:                            }
1645:                        });
1646:                controlsColumn.addButton("StateMargin = 0px",
1647:                        new ActionListener() {
1648:                            public void actionPerformed(ActionEvent e) {
1649:                                apply(new Applicator() {
1650:                                    public void apply(AbstractButton button) {
1651:                                        if (button instanceof  ToggleButton) {
1652:                                            ((ToggleButton) button)
1653:                                                    .setStateMargin(new Extent(
1654:                                                            0));
1655:                                        }
1656:                                    }
1657:                                });
1658:                            }
1659:                        });
1660:                controlsColumn.addButton("StateMargin = 1px",
1661:                        new ActionListener() {
1662:                            public void actionPerformed(ActionEvent e) {
1663:                                apply(new Applicator() {
1664:                                    public void apply(AbstractButton button) {
1665:                                        if (button instanceof  ToggleButton) {
1666:                                            ((ToggleButton) button)
1667:                                                    .setStateMargin(new Extent(
1668:                                                            1));
1669:                                        }
1670:                                    }
1671:                                });
1672:                            }
1673:                        });
1674:                controlsColumn.addButton("StateMargin = 2px",
1675:                        new ActionListener() {
1676:                            public void actionPerformed(ActionEvent e) {
1677:                                apply(new Applicator() {
1678:                                    public void apply(AbstractButton button) {
1679:                                        if (button instanceof  ToggleButton) {
1680:                                            ((ToggleButton) button)
1681:                                                    .setStateMargin(new Extent(
1682:                                                            2));
1683:                                        }
1684:                                    }
1685:                                });
1686:                            }
1687:                        });
1688:                controlsColumn.addButton("StateMargin = 10px",
1689:                        new ActionListener() {
1690:                            public void actionPerformed(ActionEvent e) {
1691:                                apply(new Applicator() {
1692:                                    public void apply(AbstractButton button) {
1693:                                        if (button instanceof  ToggleButton) {
1694:                                            ((ToggleButton) button)
1695:                                                    .setStateMargin(new Extent(
1696:                                                            10));
1697:                                        }
1698:                                    }
1699:                                });
1700:                            }
1701:                        });
1702:                controlsColumn.addButton("StateMargin = 1in",
1703:                        new ActionListener() {
1704:                            public void actionPerformed(ActionEvent e) {
1705:                                apply(new Applicator() {
1706:                                    public void apply(AbstractButton button) {
1707:                                        if (button instanceof  ToggleButton) {
1708:                                            ((ToggleButton) button)
1709:                                                    .setStateMargin(new Extent(
1710:                                                            1, Extent.IN));
1711:                                        }
1712:                                    }
1713:                                });
1714:                            }
1715:                        });
1716:
1717:                // Localization
1718:
1719:                controlsColumn = new ButtonColumn();
1720:                controlGroupsColumn.add(controlsColumn);
1721:
1722:                controlsColumn.add(new Label("Localization"));
1723:
1724:                controlsColumn.addButton("Locale = null", new ActionListener() {
1725:                    public void actionPerformed(ActionEvent e) {
1726:                        apply(new Applicator() {
1727:                            public void apply(AbstractButton button) {
1728:                                button.setLocale(null);
1729:                            }
1730:                        });
1731:                    }
1732:                });
1733:                controlsColumn.addButton("Locale = US", new ActionListener() {
1734:                    public void actionPerformed(ActionEvent e) {
1735:                        apply(new Applicator() {
1736:                            public void apply(AbstractButton button) {
1737:                                button.setLocale(Locale.US);
1738:                            }
1739:                        });
1740:                    }
1741:                });
1742:                controlsColumn.addButton("Locale = HEBREW (RTL)",
1743:                        new ActionListener() {
1744:                            public void actionPerformed(ActionEvent e) {
1745:                                apply(new Applicator() {
1746:                                    public void apply(AbstractButton button) {
1747:                                        button.setLocale(new Locale("iw"));
1748:                                    }
1749:                                });
1750:                            }
1751:                        });
1752:                controlsColumn.addButton("LayoutDirection = null",
1753:                        new ActionListener() {
1754:                            public void actionPerformed(ActionEvent e) {
1755:                                apply(new Applicator() {
1756:                                    public void apply(AbstractButton button) {
1757:                                        button.setLayoutDirection(null);
1758:                                    }
1759:                                });
1760:                            }
1761:                        });
1762:                controlsColumn.addButton("LayoutDirection = LTR",
1763:                        new ActionListener() {
1764:                            public void actionPerformed(ActionEvent e) {
1765:                                apply(new Applicator() {
1766:                                    public void apply(AbstractButton button) {
1767:                                        button
1768:                                                .setLayoutDirection(LayoutDirection.LTR);
1769:                                    }
1770:                                });
1771:                            }
1772:                        });
1773:                controlsColumn.addButton("LayoutDirection = RTL",
1774:                        new ActionListener() {
1775:                            public void actionPerformed(ActionEvent e) {
1776:                                apply(new Applicator() {
1777:                                    public void apply(AbstractButton button) {
1778:                                        button
1779:                                                .setLayoutDirection(LayoutDirection.RTL);
1780:                                    }
1781:                                });
1782:                            }
1783:                        });
1784:            }
1785:
1786:            public void apply(Applicator applicator) {
1787:                AbstractButton[] buttons = (AbstractButton[]) buttonList
1788:                        .toArray(new AbstractButton[buttonList.size()]);
1789:                for (int i = 0; i < buttons.length; ++i) {
1790:                    applicator.apply(buttons[i]);
1791:                }
1792:            }
1793:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.