author | lana |
Thu, 26 Dec 2013 12:04:16 -0800 | |
changeset 23010 | 6dadb192ad81 |
parent 20458 | f2423fb3fd19 |
child 24500 | 399b77799d66 |
permissions | -rw-r--r-- |
2 | 1 |
/* |
23010
6dadb192ad81
8029235: Update copyright year to match last edit in jdk8 jdk repository for 2013
lana
parents:
20458
diff
changeset
|
2 |
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. |
2 | 3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
* |
|
5 |
* This code is free software; you can redistribute it and/or modify it |
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
|
5506 | 7 |
* published by the Free Software Foundation. Oracle designates this |
2 | 8 |
* particular file as subject to the "Classpath" exception as provided |
5506 | 9 |
* by Oracle in the LICENSE file that accompanied this code. |
2 | 10 |
* |
11 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
13 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
14 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
15 |
* accompanied this code). |
|
16 |
* |
|
17 |
* You should have received a copy of the GNU General Public License version |
|
18 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
19 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
20 |
* |
|
5506 | 21 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
22 |
* or visit www.oracle.com if you need additional information or have any |
|
23 |
* questions. |
|
2 | 24 |
*/ |
25 |
package javax.swing.border; |
|
26 |
||
27 |
import java.awt.Graphics; |
|
28 |
import java.awt.Insets; |
|
29 |
import java.awt.Rectangle; |
|
30 |
import java.awt.Component; |
|
31 |
import java.io.Serializable; |
|
32 |
import java.beans.ConstructorProperties; |
|
33 |
||
34 |
/** |
|
35 |
* A class which provides an empty, transparent border which |
|
36 |
* takes up space but does no drawing. |
|
37 |
* <p> |
|
38 |
* <strong>Warning:</strong> |
|
39 |
* Serialized objects of this class will not be compatible with |
|
40 |
* future Swing releases. The current serialization support is |
|
41 |
* appropriate for short term storage or RMI between applications running |
|
42 |
* the same version of Swing. As of 1.4, support for long term storage |
|
20458 | 43 |
* of all JavaBeans™ |
2 | 44 |
* has been added to the <code>java.beans</code> package. |
45 |
* Please see {@link java.beans.XMLEncoder}. |
|
46 |
* |
|
47 |
* @author David Kloba |
|
48 |
*/ |
|
11268 | 49 |
@SuppressWarnings("serial") |
2 | 50 |
public class EmptyBorder extends AbstractBorder implements Serializable |
51 |
{ |
|
52 |
protected int left, right, top, bottom; |
|
53 |
||
54 |
/** |
|
55 |
* Creates an empty border with the specified insets. |
|
56 |
* @param top the top inset of the border |
|
57 |
* @param left the left inset of the border |
|
58 |
* @param bottom the bottom inset of the border |
|
59 |
* @param right the right inset of the border |
|
60 |
*/ |
|
61 |
public EmptyBorder(int top, int left, int bottom, int right) { |
|
62 |
this.top = top; |
|
63 |
this.right = right; |
|
64 |
this.bottom = bottom; |
|
65 |
this.left = left; |
|
66 |
} |
|
67 |
||
68 |
/** |
|
69 |
* Creates an empty border with the specified insets. |
|
70 |
* @param borderInsets the insets of the border |
|
71 |
*/ |
|
72 |
@ConstructorProperties({"borderInsets"}) |
|
73 |
public EmptyBorder(Insets borderInsets) { |
|
74 |
this.top = borderInsets.top; |
|
75 |
this.right = borderInsets.right; |
|
76 |
this.bottom = borderInsets.bottom; |
|
77 |
this.left = borderInsets.left; |
|
78 |
} |
|
79 |
||
80 |
/** |
|
81 |
* Does no drawing by default. |
|
82 |
*/ |
|
83 |
public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) { |
|
84 |
} |
|
85 |
||
86 |
/** |
|
87 |
* Reinitialize the insets parameter with this Border's current Insets. |
|
88 |
* @param c the component for which this border insets value applies |
|
89 |
* @param insets the object to be reinitialized |
|
90 |
*/ |
|
91 |
public Insets getBorderInsets(Component c, Insets insets) { |
|
92 |
insets.left = left; |
|
93 |
insets.top = top; |
|
94 |
insets.right = right; |
|
95 |
insets.bottom = bottom; |
|
96 |
return insets; |
|
97 |
} |
|
98 |
||
99 |
/** |
|
100 |
* Returns the insets of the border. |
|
101 |
* @since 1.3 |
|
102 |
*/ |
|
103 |
public Insets getBorderInsets() { |
|
104 |
return new Insets(top, left, bottom, right); |
|
105 |
} |
|
106 |
||
107 |
/** |
|
108 |
* Returns whether or not the border is opaque. |
|
109 |
* Returns false by default. |
|
110 |
*/ |
|
111 |
public boolean isBorderOpaque() { return false; } |
|
112 |
||
113 |
} |