Source Code Cross Referenced for BorderExample.java in  » Swing-Library » wings3 » org » wings » example » Java Source Code / Java DocumentationJava Source Code and Java Documentation

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


001:        /*
002:         * BorderExample.java
003:         *
004:         * Created on 31. Mai 2007, 14:37
005:         *
006:         * To change this template, choose Tools | Template Manager
007:         * and open the template in the editor.
008:         */
009:
010:        package org.wings.example;
011:
012:        import java.awt.Color;
013:        import javax.swing.ImageIcon;
014:        import org.wings.*;
015:        import org.wings.plaf.WingSetExample;
016:        import org.wings.border.*;
017:
018:        /**
019:         * BorderDemo.java requires the following file:
020:         *    images/wavy.gif
021:         * @author pet
022:         */
023:        public class BorderExample implements  WingSetExample {
024:            private SPanel panel;
025:
026:            public void activateExample() {
027:                SGridLayout layout = new SGridLayout(1, 0);
028:                panel = new SPanel(layout);
029:
030:                //Keep references to the next few borders,
031:                //for use in titles and compound borders.
032:                SBorder blackline, raisedetched, loweredetched, raisedbevel, loweredbevel, empty;
033:
034:                //A border that puts 10 extra pixels at the sides and
035:                //bottom of each pane.
036:                SBorder paneEdge = SBorderFactory.createSEmptyBorder(0, 10, 10,
037:                        10);
038:
039:                blackline = SBorderFactory.createSLineBorder(Color.black);
040:                raisedetched = SBorderFactory
041:                        .createSEtchedBorder(SEtchedBorder.RAISED);
042:                loweredetched = SBorderFactory
043:                        .createSEtchedBorder(SEtchedBorder.LOWERED);
044:                raisedbevel = SBorderFactory.createRaisedSBevelBorder();
045:                loweredbevel = SBorderFactory.createLoweredSBevelBorder();
046:                empty = SBorderFactory.createSEmptyBorder();
047:
048:                //First pane: simple borders
049:                SPanel simpleBorders = new SPanel();
050:                simpleBorders.setBorder(paneEdge);
051:                simpleBorders.setLayout(new SBoxLayout(SBoxLayout.Y_AXIS));
052:
053:                addCompForBorder(blackline, "line border", simpleBorders);
054:                addCompForBorder(raisedetched, "raised etched border",
055:                        simpleBorders);
056:                addCompForBorder(loweredetched, "lowered etched border",
057:                        simpleBorders);
058:                addCompForBorder(raisedbevel, "raised bevel border",
059:                        simpleBorders);
060:                addCompForBorder(loweredbevel, "lowered bevel border",
061:                        simpleBorders);
062:                addCompForBorder(empty, "empty border", simpleBorders);
063:
064:                //Second pane: matte borders
065:                SPanel matteBorders = new SPanel();
066:                matteBorders.setBorder(paneEdge);
067:                matteBorders.setLayout(new SBoxLayout(SBoxLayout.Y_AXIS));
068:
069:                ImageIcon icon = createImageIcon("images/wavy.gif",
070:                        "wavy-line border icon"); //20x22
071:                //Third pane: titled borders
072:                SPanel titledBorders = new SPanel();
073:                titledBorders.setBorder(paneEdge);
074:                titledBorders.setLayout(new SBoxLayout(SBoxLayout.Y_AXIS));
075:                STitledBorder titled;
076:
077:                titled = new STitledBorder("title");
078:                addCompForBorder(titled, "default titled border"
079:                        + " (default just., default pos.)", titledBorders);
080:
081:                titled = new STitledBorder(blackline, "title");
082:                addCompForTitledBorder(titled, "titled line border"
083:                        + " (centered, default pos.)", STitledBorder.CENTER,
084:                        STitledBorder.DEFAULT_POSITION, titledBorders);
085:
086:                titled = new STitledBorder("title");
087:                addCompForTitledBorder(titled, "titled line border Bold"
088:                        + " (centered, default pos.)", STitledBorder.CENTER,
089:                        STitledBorder.DEFAULT_POSITION, titledBorders);
090:                titled.setTitleFont(new SFont(SFont.BOLD));
091:
092:                titled = new STitledBorder("title");
093:                addCompForTitledBorder(titled, "titled line border Italix RED"
094:                        + " (centered, default pos.)", STitledBorder.CENTER,
095:                        STitledBorder.DEFAULT_POSITION, titledBorders);
096:                titled.setTitleFont(new SFont(SFont.ITALIC));
097:                titled.setTitleColor(java.awt.Color.RED);
098:
099:                titled = new STitledBorder(loweredetched, "title");
100:                titled.getBorder().setColor(java.awt.Color.GREEN);
101:                addCompForTitledBorder(titled,
102:                        "titled lowered Green etched border"
103:                                + " (right just., default pos.)",
104:                        STitledBorder.RIGHT, STitledBorder.DEFAULT_POSITION,
105:                        titledBorders);
106:
107:                titled = new STitledBorder(loweredbevel, "title");
108:                addCompForTitledBorder(titled, "titled lowered bevel border"
109:                        + " (default just., above top)",
110:                        STitledBorder.DEFAULT_JUSTIFICATION,
111:                        STitledBorder.ABOVE_TOP, titledBorders);
112:
113:                titled = new STitledBorder(empty, "title");
114:                addCompForTitledBorder(titled, "titled empty border"
115:                        + " (default just., bottom)",
116:                        STitledBorder.DEFAULT_JUSTIFICATION,
117:                        STitledBorder.BOTTOM, titledBorders);
118:
119:                //Fourth pane: compound borders
120:                SPanel compoundBorders = new SPanel();
121:                compoundBorders.setBorder(paneEdge);
122:                compoundBorders.setLayout(new SBoxLayout(SBoxLayout.Y_AXIS));
123:                SBorder redline = SBorderFactory.createSLineBorder(Color.red);
124:
125:                STabbedPane tabbedPane = new STabbedPane();
126:                tabbedPane.addTab("Simple", null, simpleBorders, null);
127:                // tabbedPane.addTab("Matte", null, matteBorders, null);
128:                tabbedPane.addTab("Titled", null, titledBorders, null);
129:                // tabbedPane.addTab("Compound", null, compoundBorders, null);
130:                tabbedPane.setSelectedIndex(0);
131:                String toolTip = new String(
132:                        "<html>Blue Wavy Line border art crew:<br>&nbsp;&nbsp;&nbsp;Bill Pauley<br>&nbsp;&nbsp;&nbsp;Cris St. Aubyn<br>&nbsp;&nbsp;&nbsp;Ben Wronsky<br>&nbsp;&nbsp;&nbsp;Nathan Walrath<br>&nbsp;&nbsp;&nbsp;Tommy Adams, special consultant</html>");
133:                tabbedPane.setToolTipTextAt(1, toolTip);
134:
135:                panel.add(tabbedPane);
136:            }
137:
138:            void addCompForTitledBorder(STitledBorder border,
139:                    String description, int justification, int position,
140:                    SContainer container) {
141:                border.setTitleJustification(justification);
142:                //order.setTitlePosition(position);
143:                addCompForBorder(border, description, container);
144:            }
145:
146:            void addCompForBorder(SBorder border, String description,
147:                    SContainer container) {
148:                SPanel comp = new SPanel(new SGridLayout(1, 1));
149:                SLabel label = new SLabel(description, SConstants.CENTER);
150:                comp.add(label);
151:                comp.setBorder(border);
152:
153:                // container.add(Box.createRigidArea(new Dimension(0, 10)));
154:                container.add(comp);
155:            }
156:
157:            /** Returns an ImageIcon, or null if the path was invalid. */
158:            protected static ImageIcon createImageIcon(String path,
159:                    String description) {
160:                java.net.URL imgURL = BorderExample.class.getResource(path);
161:                if (imgURL != null) {
162:                    return new ImageIcon(imgURL, description);
163:                } else {
164:                    System.err.println("Couldn't find file: " + path);
165:                    return null;
166:                }
167:            }
168:
169:            public void passivateExample() {
170:                //To change body of implemented methods use File | Settings | File Templates.
171:            }
172:
173:            public SComponent getExample() {
174:                return panel;
175:            }
176:
177:            public String getExampleName() {
178:                return "TitledBorder";
179:            }
180:
181:            public String getExampleGroup() {
182:                return "Experiment";
183:            }
184:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.