Source Code Cross Referenced for Insets.java in  » 6.0-JDK-Core » AWT » java » awt » 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 » 6.0 JDK Core » AWT » java.awt 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright 1995-2003 Sun Microsystems, Inc.  All Rights Reserved.
003:         * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
004:         *
005:         * This code is free software; you can redistribute it and/or modify it
006:         * under the terms of the GNU General Public License version 2 only, as
007:         * published by the Free Software Foundation.  Sun designates this
008:         * particular file as subject to the "Classpath" exception as provided
009:         * by Sun in the LICENSE file that accompanied this code.
010:         *
011:         * This code is distributed in the hope that it will be useful, but WITHOUT
012:         * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
013:         * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
014:         * version 2 for more details (a copy is included in the LICENSE file that
015:         * accompanied this code).
016:         *
017:         * You should have received a copy of the GNU General Public License version
018:         * 2 along with this work; if not, write to the Free Software Foundation,
019:         * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
020:         *
021:         * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
022:         * CA 95054 USA or visit www.sun.com if you need additional information or
023:         * have any questions.
024:         */
025:
026:        package java.awt;
027:
028:        /**
029:         * An <code>Insets</code> object is a representation of the borders 
030:         * of a container. It specifies the space that a container must leave 
031:         * at each of its edges. The space can be a border, a blank space, or 
032:         * a title. 
033:         *
034:         * @version 	1.37, 05/05/07
035:         * @author 	Arthur van Hoff
036:         * @author 	Sami Shaio
037:         * @see         java.awt.LayoutManager
038:         * @see         java.awt.Container
039:         * @since       JDK1.0
040:         */
041:        public class Insets implements  Cloneable, java.io.Serializable {
042:
043:            /**
044:             * The inset from the top.
045:             * This value is added to the Top of the rectangle
046:             * to yield a new location for the Top.
047:             *
048:             * @serial
049:             * @see #clone()
050:             */
051:            public int top;
052:
053:            /**
054:             * The inset from the left.
055:             * This value is added to the Left of the rectangle
056:             * to yield a new location for the Left edge.
057:             *
058:             * @serial
059:             * @see #clone()
060:             */
061:            public int left;
062:
063:            /**
064:             * The inset from the bottom.
065:             * This value is subtracted from the Bottom of the rectangle
066:             * to yield a new location for the Bottom.
067:             *
068:             * @serial
069:             * @see #clone()
070:             */
071:            public int bottom;
072:
073:            /**
074:             * The inset from the right.
075:             * This value is subtracted from the Right of the rectangle
076:             * to yield a new location for the Right edge.
077:             *
078:             * @serial
079:             * @see #clone()
080:             */
081:            public int right;
082:
083:            /*
084:             * JDK 1.1 serialVersionUID 
085:             */
086:            private static final long serialVersionUID = -2272572637695466749L;
087:
088:            static {
089:                /* ensure that the necessary native libraries are loaded */
090:                Toolkit.loadLibraries();
091:                if (!GraphicsEnvironment.isHeadless()) {
092:                    initIDs();
093:                }
094:            }
095:
096:            /**
097:             * Creates and initializes a new <code>Insets</code> object with the 
098:             * specified top, left, bottom, and right insets. 
099:             * @param       top   the inset from the top.
100:             * @param       left   the inset from the left.
101:             * @param       bottom   the inset from the bottom.
102:             * @param       right   the inset from the right.
103:             */
104:            public Insets(int top, int left, int bottom, int right) {
105:                this .top = top;
106:                this .left = left;
107:                this .bottom = bottom;
108:                this .right = right;
109:            }
110:
111:            /**
112:             * Set top, left, bottom, and right to the specified values
113:             *
114:             * @param       top   the inset from the top.
115:             * @param       left   the inset from the left.
116:             * @param       bottom   the inset from the bottom.
117:             * @param       right   the inset from the right.
118:             * @since 1.5
119:             */
120:            public void set(int top, int left, int bottom, int right) {
121:                this .top = top;
122:                this .left = left;
123:                this .bottom = bottom;
124:                this .right = right;
125:            }
126:
127:            /**
128:             * Checks whether two insets objects are equal. Two instances 
129:             * of <code>Insets</code> are equal if the four integer values
130:             * of the fields <code>top</code>, <code>left</code>, 
131:             * <code>bottom</code>, and <code>right</code> are all equal.
132:             * @return      <code>true</code> if the two insets are equal;
133:             *                          otherwise <code>false</code>.
134:             * @since       JDK1.1
135:             */
136:            public boolean equals(Object obj) {
137:                if (obj instanceof  Insets) {
138:                    Insets insets = (Insets) obj;
139:                    return ((top == insets.top) && (left == insets.left)
140:                            && (bottom == insets.bottom) && (right == insets.right));
141:                }
142:                return false;
143:            }
144:
145:            /**
146:             * Returns the hash code for this Insets.
147:             *
148:             * @return    a hash code for this Insets.
149:             */
150:            public int hashCode() {
151:                int sum1 = left + bottom;
152:                int sum2 = right + top;
153:                int val1 = sum1 * (sum1 + 1) / 2 + left;
154:                int val2 = sum2 * (sum2 + 1) / 2 + top;
155:                int sum3 = val1 + val2;
156:                return sum3 * (sum3 + 1) / 2 + val2;
157:            }
158:
159:            /**
160:             * Returns a string representation of this <code>Insets</code> object. 
161:             * This method is intended to be used only for debugging purposes, and 
162:             * the content and format of the returned string may vary between 
163:             * implementations. The returned string may be empty but may not be 
164:             * <code>null</code>.
165:             * 
166:             * @return  a string representation of this <code>Insets</code> object.
167:             */
168:            public String toString() {
169:                return getClass().getName() + "[top=" + top + ",left=" + left
170:                        + ",bottom=" + bottom + ",right=" + right + "]";
171:            }
172:
173:            /**
174:             * Create a copy of this object.
175:             * @return     a copy of this <code>Insets</code> object.
176:             */
177:            public Object clone() {
178:                try {
179:                    return super .clone();
180:                } catch (CloneNotSupportedException e) {
181:                    // this shouldn't happen, since we are Cloneable
182:                    throw new InternalError();
183:                }
184:            }
185:
186:            /**
187:             * Initialize JNI field and method IDs
188:             */
189:            private static native void initIDs();
190:
191:        }
w_w___w_._j__a_v__a2___s._c_om_ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.