52 |
* @author Sascha Brawer (brawer@dandelis.ch) |
* @author Sascha Brawer (brawer@dandelis.ch) |
53 |
* @author Ronald Veldema (rveldema@cs.vu.nl) |
* @author Ronald Veldema (rveldema@cs.vu.nl) |
54 |
*/ |
*/ |
55 |
public abstract class AbstractBorder |
public abstract class AbstractBorder implements Border, Serializable |
|
implements Border, Serializable |
|
56 |
{ |
{ |
57 |
static final long serialVersionUID = -545885975315191844L; |
static final long serialVersionUID = -545885975315191844L; |
58 |
|
|
|
|
|
59 |
/** |
/** |
60 |
* Constructs a new AbstractBorder. |
* Constructs a new AbstractBorder. |
61 |
*/ |
*/ |
62 |
public AbstractBorder () |
public AbstractBorder() |
63 |
{ |
{ |
64 |
|
// Nothing to do here. |
65 |
} |
} |
66 |
|
|
|
|
|
67 |
/** |
/** |
68 |
* Performs nothing, because the default implementation provided by |
* Performs nothing, because the default implementation provided by |
69 |
* this class is an invisible, zero-width border. Subclasses will |
* this class is an invisible, zero-width border. Subclasses will |
77 |
* @param width the width of the available area for painting the border. |
* @param width the width of the available area for painting the border. |
78 |
* @param height the height of the available area for painting the border. |
* @param height the height of the available area for painting the border. |
79 |
*/ |
*/ |
80 |
public void paintBorder (Component c, Graphics g, |
public void paintBorder(Component c, Graphics g, int x, int y, int width, |
81 |
int x, int y, int width, int height) |
int height) |
82 |
{ |
{ |
83 |
/* A previous version of Classpath had emitted a warning when |
// A previous version of Classpath had emitted a warning when |
84 |
* this method was called. The warning was removed because it is |
// this method was called. The warning was removed because it is |
85 |
* perfectly legal for a subclass to not override the paintBorder |
// perfectly legal for a subclass to not override the paintBorder |
86 |
* method. An example would be EmptyBorder. |
// method. An example would be EmptyBorder. |
|
*/ |
|
87 |
} |
} |
88 |
|
|
|
|
|
89 |
/** |
/** |
90 |
* Measures the width of this border. |
* Measures the width of this border. |
91 |
* |
* |
98 |
* |
* |
99 |
* @see #getBorderInsets(java.awt.Component, java.awt.Insets) |
* @see #getBorderInsets(java.awt.Component, java.awt.Insets) |
100 |
*/ |
*/ |
101 |
public Insets getBorderInsets (Component c) |
public Insets getBorderInsets(Component c) |
102 |
{ |
{ |
103 |
return new Insets (0, 0, 0, 0); |
return new Insets(0, 0, 0, 0); |
104 |
} |
} |
105 |
|
|
|
|
|
106 |
/** |
/** |
107 |
* Determines the insets of this border. The implementation provided |
* Determines the insets of this border. The implementation provided |
108 |
* by AbstractButton sets the <code>left</code>, <code>right</code>, |
* by AbstractButton sets the <code>left</code>, <code>right</code>, |
109 |
* <code>top</code> and <code>bottom</code> fields of the passed |
* <code>top</code> and <code>bottom</code> fields of the passed |
110 |
* <code>insets</code> parameter to zero. |
* <code>insets</code> parameter to zero. |
111 |
* |
* |
112 |
* @param c the component whose border is to be measured. |
* @param c the component whose border is to be measured |
113 |
* |
* |
114 |
* @return the same object that was passed for <code>insets</code>. |
* @return the same object that was passed for <code>insets</code> |
115 |
* |
* |
116 |
* @see #getBorderInsets(Component) |
* @see #getBorderInsets(Component) |
117 |
*/ |
*/ |
118 |
public Insets getBorderInsets (Component c, Insets insets) |
public Insets getBorderInsets(Component c, Insets insets) |
119 |
{ |
{ |
120 |
insets.left = insets.right = insets.top = insets.bottom = 0; |
insets.left = insets.right = insets.top = insets.bottom = 0; |
121 |
return insets; |
return insets; |
122 |
} |
} |
123 |
|
|
|
|
|
124 |
/** |
/** |
125 |
* Determines whether or not this border is opaque. An opaque border |
* Determines whether or not this border is opaque. An opaque border |
126 |
* fills every pixel in its area when painting. Partially |
* fills every pixel in its area when painting. Partially |
130 |
* |
* |
131 |
* @return <code>false</code>. |
* @return <code>false</code>. |
132 |
*/ |
*/ |
133 |
public boolean isBorderOpaque () |
public boolean isBorderOpaque() |
134 |
{ |
{ |
135 |
return false; |
return false; |
136 |
} |
} |
137 |
|
|
|
|
|
138 |
/** |
/** |
139 |
* Returns a rectangle that covers the specified area minus this |
* Returns a rectangle that covers the specified area minus this |
140 |
* border. Components that wish to determine an area into which |
* border. Components that wish to determine an area into which |
147 |
* @param width the width of the available area for the border. |
* @param width the width of the available area for the border. |
148 |
* @param height the height of the available area for the border. |
* @param height the height of the available area for the border. |
149 |
*/ |
*/ |
150 |
public Rectangle getInteriorRectangle (Component c, |
public Rectangle getInteriorRectangle(Component c, int x, int y, int width, |
151 |
int x, int y, int width, int height) |
int height) |
152 |
{ |
{ |
153 |
return getInteriorRectangle (c, this, x, y, width, height); |
return getInteriorRectangle (c, this, x, y, width, height); |
154 |
} |
} |
|
|
|
155 |
|
|
156 |
/** |
/** |
157 |
* Returns a rectangle that covers the specified area minus a |
* Returns a rectangle that covers the specified area minus a |
165 |
* @param width the width of the available area for the border. |
* @param width the width of the available area for the border. |
166 |
* @param height the height of the available area for the border. |
* @param height the height of the available area for the border. |
167 |
*/ |
*/ |
168 |
public static Rectangle getInteriorRectangle (Component c, Border b, |
public static Rectangle getInteriorRectangle(Component c, Border b, int x, |
169 |
int x, int y, int width, int height) |
int y, int width, int height) |
170 |
{ |
{ |
171 |
Insets borderInsets; |
Insets borderInsets; |
172 |
|
|