Source Code Cross Referenced for ListPanel.java in  » Web-Framework » wingS » com » javujavu » javux » demo » Java Source Code / Java DocumentationJava Source Code and Java Documentation

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


001:        /*
002:         *	Javu WingS - Lightweight Java Component Set
003:         *	Copyright (c) 2005-2007 Krzysztof A. Sadlocha
004:         *	e-mail: ksadlocha@programics.com
005:         *
006:         *	This library is free software; you can redistribute it and/or
007:         *	modify it under the terms of the GNU Lesser General Public
008:         *	License as published by the Free Software Foundation; either
009:         *	version 2.1 of the License, or (at your option) any later version.
010:         *
011:         *	This library is distributed in the hope that it will be useful,
012:         *	but WITHOUT ANY WARRANTY; without even the implied warranty of
013:         *	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
014:         *	Lesser General Public License for more details.
015:         *
016:         *	You should have received a copy of the GNU Lesser General Public
017:         *	License along with this library; if not, write to the Free Software
018:         *	Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
019:         */
020:
021:        package com.javujavu.javux.demo;
022:
023:        import java.awt.BorderLayout;
024:        import java.awt.Color;
025:        import java.awt.GridBagConstraints;
026:        import java.awt.GridBagLayout;
027:        import java.awt.GridLayout;
028:        import java.awt.Insets;
029:        import java.awt.event.ActionEvent;
030:        import java.awt.event.ActionListener;
031:        import java.awt.event.ItemEvent;
032:        import java.awt.event.ItemListener;
033:        import com.javujavu.javux.wings.WingButton;
034:        import com.javujavu.javux.wings.WingLabel;
035:        import com.javujavu.javux.wings.WingList;
036:        import com.javujavu.javux.wings.WingPanel;
037:        import com.javujavu.javux.wings.WingScrollPane;
038:        import com.javujavu.javux.wings.extra.ColorItem;
039:        import com.javujavu.javux.wings.item.LabelItem;
040:
041:        public class ListPanel extends WingPanel implements  ActionListener,
042:                ItemListener {
043:            private WingButton bAdd;
044:            private WingButton bInsert;
045:            private WingButton bRemove;
046:            private WingList list1;
047:            private WingList target;
048:            private WingList list2;
049:            private WingList list3;
050:
051:            public ListPanel(WingSetPanel owner) {
052:                this .setLayout(new GridBagLayout());
053:                WingPanel panel = new WingPanel(new GridLayout(0, 2, 8, 8));
054:                GridBagConstraints c = new GridBagConstraints();
055:                c.insets = new Insets(10, 10, 10, 10);
056:                c.anchor = GridBagConstraints.CENTER;
057:                c.fill = GridBagConstraints.BOTH;
058:                c.weightx = 1.0;
059:                c.weighty = 1.0;
060:                c.gridwidth = GridBagConstraints.REMAINDER;
061:                this .add(panel, c);
062:
063:                WingList list;
064:                WingPanel panel2;
065:                panel.add(panel2 = new WingPanel(new BorderLayout()));
066:                panel2.add(new WingScrollPane(list1 = list = new WingList(
067:                        WingList.VERTICAL)));
068:                WingPanel panel3;
069:                panel2.add(panel3 = new WingPanel(new BorderLayout()),
070:                        BorderLayout.NORTH);
071:                panel3.setStyleId("border2");
072:                panel3
073:                        .add(new WingLabel("vertical alignment",
074:                                WingLabel.CENTER));
075:                addItems(list);
076:                list.addItem(new LabelItem("animated", WingSet.imgAnim));
077:                list.setTooltip(new LabelItem(
078:                        "list with vertical alignment\ndefault style",
079:                        WingSet.imgEye));
080:
081:                panel.add(panel2 = new WingPanel(new BorderLayout()));
082:                panel2.add(new WingScrollPane(list2 = list = new WingList(
083:                        WingList.VERTICAL_WRAP)));
084:                WingPanel p3;
085:                panel2.add(p3 = new WingPanel(new GridBagLayout()),
086:                        BorderLayout.NORTH);
087:                c = new GridBagConstraints();
088:                c.weightx = 1.0;
089:                p3.add(new WingLabel("vertical wrap alignment",
090:                        WingLabel.CENTER), c);
091:                WingButton b;
092:                c.weightx = 0.0;
093:                p3.add(b = new WingButton("TopStyle"), c);
094:                b.setStyleId("vpopup");
095:                b.setTextPosition(LEFT);
096:                b.setFastAction(true);
097:                b
098:                        .setTooltip(new LabelItem(
099:                                "modify TopStyle of this WingList\nTopStyle is an extra style overriding stylesheet settings \ndynamically at run time\nclick button to change settings",
100:                                WingSet.imgIcon, LEFT, RIGHT));
101:                new TopStyleEditor(b, list2, 0, 0, false);
102:                addItems(list);
103:                list.setTooltip(new LabelItem(
104:                        "list with vertical wrap alignment\ndefault style",
105:                        WingSet.imgDrink));
106:
107:                panel.add(panel2 = new WingPanel(new BorderLayout()));
108:                panel2.add(new WingScrollPane(list3 = list = new WingList(
109:                        WingList.HORIZONTAL_WRAP)));
110:                panel2.add(new WingLabel("horizontal wrap alignment",
111:                        WingLabel.CENTER), BorderLayout.NORTH);
112:                addItems(list);
113:                list.setTooltip(new LabelItem(
114:                        "list with horizontal wrap alignment\ndefault style",
115:                        WingSet.imgTired));
116:
117:                panel.add(panel2 = new WingPanel(new BorderLayout()));
118:                panel2.add(new WingScrollPane(list = new WingList(
119:                        WingList.VERTICAL)));
120:                panel2.add(new WingLabel("disabled list", WingLabel.CENTER),
121:                        BorderLayout.NORTH);
122:                addItems(list);
123:                list.setEnabled(false);
124:                list.setTooltip(new LabelItem(
125:                        "disabled list with vetrical alignment\ndefault style",
126:                        WingSet.imgYawn));
127:
128:                this .add(p3 = new WingPanel(new GridLayout(1, 0)));
129:                p3.add(bAdd = new WingButton("add item"));
130:                p3.add(bInsert = new WingButton("insert item"));
131:                p3.add(bRemove = new WingButton("remove selected"));
132:
133:                this .addActionListener(this );
134:                this .addItemListener(this );
135:            }
136:
137:            static Object[] getItems() {
138:                Object[] its = {
139:                        new LabelItem("text and icon 1", WingSet.imgSmile),
140:                        new LabelItem("text and icon 2", WingSet.imgGlasses),
141:                        new LabelItem("text and icon 3", WingSet.imgTongue),
142:                        new LabelItem("text and icon 4", WingSet.imgSilence),
143:                        "text item 1", "text item 2", WingSet.imgAngel,
144:                        WingSet.imgTired, "text item 3",
145:                        new ColorItem("color red", Color.red),
146:                        new ColorItem("color green", Color.green),
147:                        new ColorItem("color blue", Color.blue),
148:                        new ColorItem("color magenta", Color.magenta),
149:                        new ColorItem("color orange", Color.orange) };
150:                return its;
151:            }
152:
153:            static void addItems(WingList list) {
154:                Object[] its = getItems();
155:                for (int i = 0; i < its.length; i++)
156:                    list.addItem(its[i]);
157:            }
158:
159:            static private Object makeItem() {
160:                Object[] its = getItems();
161:                return its[(int) (Math.random() * its.length)];
162:            }
163:
164:            public void actionPerformed(ActionEvent e) {
165:                if (target == null)
166:                    target = list1;
167:                Object src = e.getSource();
168:                if (src == bAdd) {
169:                    target.addItem(makeItem());
170:                } else if (src == bInsert) {
171:                    int i = target.getSelectedIndex();
172:                    if (i == -1)
173:                        i = 0;
174:                    target.insertItem(makeItem(), i);
175:                } else if (src == bRemove) {
176:                    int i = target.getSelectedIndex();
177:                    if (i != -1)
178:                        target.removeItem(i);
179:                }
180:            }
181:
182:            public void itemStateChanged(ItemEvent e) {
183:                Object src = e.getSource();
184:                if (src == list1)
185:                    target = list1;
186:                else if (src == list2)
187:                    target = list2;
188:                else if (src == list3)
189:                    target = list3;
190:            }
191:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.