Source Code Cross Referenced for SBorderLayout.java in  » Swing-Library » Swinglets » com » javelin » swinglets » 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 » Swinglets » com.javelin.swinglets 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright Javelin Software, All rights reserved.
003:         */
004:
005:        package com.javelin.swinglets;
006:
007:        import java.util.*;
008:        import java.io.*;
009:
010:        import com.javelin.swinglets.plaf.*;
011:
012:        /**
013:         * SBorderLayout is used to layout SComponents in a SContainer.
014:         * <P>
015:         * The SBorderLayout component is based on the java.awt.BorderLayout
016:         * LayoutManager.
017:         * 
018:         * @author Robin Sharp
019:         */
020:
021:        public class SBorderLayout extends SLayoutManager {
022:            /**
023:             * Layout the component across the top of the container.
024:             */
025:            public static final String NORTH = "North";
026:
027:            /**
028:             * Layout the component across the bottom of container.
029:             */
030:            public final static String SOUTH = "South";
031:
032:            /**
033:             * Layout the component on the left side of container.
034:             */
035:            public final static String EAST = "East";
036:
037:            /**
038:             * Layout the component on the right side of container.
039:             */
040:            public final static String WEST = "West";
041:
042:            /**
043:             * Layout the component in the middle of container.
044:             */
045:            public final static String CENTER = "Center";
046:
047:            /**
048:             * Construct a fully qualified SBorderLayout.
049:             */
050:            public SBorderLayout() {
051:            }
052:
053:            /**
054:             * Construct a fully qualified SBorderLayout, 2 columns, and n rows.
055:             * Set the rows and columns to 0 to let the layout manager figure
056:             * out the correct number of rows or columns.
057:             */
058:            public SBorderLayout(int gap) {
059:                setGap(gap);
060:            }
061:
062:            /**
063:             * Returns the name of the L&F class that renders this layout.
064:             */
065:            public Class getUIClass() {
066:                return SBorderLayout.class;
067:            }
068:
069:            /**
070:             * Add a component, at a location.
071:             * If the component is null then it is removed.
072:             */
073:            public void addComponent(SComponent component, Object constraint) {
074:                if (constraint == null)
075:                    constraint = CENTER;
076:
077:                if (!(constraint instanceof  String)) {
078:                    throw new IllegalArgumentException(
079:                            "Constraint must be integer. "
080:                                    + constraint.getClass());
081:                }
082:
083:                if (!(constraint.equals(NORTH) || constraint.equals(SOUTH)
084:                        || constraint.equals(EAST) || constraint.equals(WEST) || constraint
085:                        .equals(CENTER))) {
086:                    throw new IllegalArgumentException("Unknown Constraint "
087:                            + constraint);
088:                }
089:
090:                if (component == null) {
091:                    components.remove(constraint);
092:                } else {
093:                    components.put(constraint, component);
094:                }
095:            }
096:
097:            /**
098:             * Get component from a contraint.
099:             */
100:            public SComponent getComponent(Object constraint) {
101:                return (SComponent) components.get(constraint);
102:            }
103:
104:            /**
105:             * Remove a component.
106:             */
107:            public void removeComponent(SComponent component) {
108:                Object value = null;
109:                Object key = null;
110:
111:                for (Enumeration keys = components.keys(); keys
112:                        .hasMoreElements();) {
113:                    key = keys.nextElement();
114:                    value = components.get(key);
115:
116:                    if (component == value) {
117:                        components.remove(key);
118:                        return;
119:                    }
120:                }
121:            }
122:
123:            /**
124:             * Get the gap.
125:             */
126:            public int getGap() {
127:                return gap;
128:            }
129:
130:            /**
131:             * Set the gap.
132:             */
133:            public void setGap(int gap) {
134:                if (gap < 0)
135:                    throw new IllegalArgumentException("gap < 0");
136:                this .gap = gap;
137:            }
138:
139:            // PRIVATE /////////////////////////////////////////////////////////
140:
141:            private Hashtable components = new Hashtable();
142:            private int gap;
143:
144:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.