69 |
/** The shared instance for getButtonBorder(). */ |
/** The shared instance for getButtonBorder(). */ |
70 |
private static Border buttonBorder; |
private static Border buttonBorder; |
71 |
|
|
72 |
|
/** The shared instance for getDesktopIconBorder(). */ |
73 |
|
private static Border desktopIconBorder; |
74 |
|
|
75 |
/** The shared instance for getRolloverButtonBorder(). */ |
/** The shared instance for getRolloverButtonBorder(). */ |
76 |
private static Border toolbarButtonBorder; |
private static Border toolbarButtonBorder; |
77 |
|
|
194 |
} |
} |
195 |
|
|
196 |
/** |
/** |
197 |
|
* A border used when painting {@link JInternalFrame} instances. |
198 |
|
*/ |
199 |
|
static class DesktopIconBorder extends AbstractBorder |
200 |
|
implements UIResource |
201 |
|
{ |
202 |
|
/** |
203 |
|
* Creates a new border instance. |
204 |
|
*/ |
205 |
|
public DesktopIconBorder() |
206 |
|
{ |
207 |
|
} |
208 |
|
|
209 |
|
/** |
210 |
|
* Returns the border insets. |
211 |
|
* |
212 |
|
* @param c the component (ignored). |
213 |
|
* |
214 |
|
* @return The border insets. |
215 |
|
*/ |
216 |
|
public Insets getBorderInsets(Component c) |
217 |
|
{ |
218 |
|
return getBorderInsets(c, null); |
219 |
|
} |
220 |
|
|
221 |
|
/** |
222 |
|
* Returns the border insets. |
223 |
|
* |
224 |
|
* @param c the component (ignored). |
225 |
|
* @return The border insets. |
226 |
|
*/ |
227 |
|
public Insets getBorderInsets(Component c, Insets newInsets) |
228 |
|
{ |
229 |
|
if (newInsets == null) |
230 |
|
newInsets = new Insets(3, 3, 2, 3); |
231 |
|
else |
232 |
|
{ |
233 |
|
newInsets.top = 3; |
234 |
|
newInsets.left = 3; |
235 |
|
newInsets.bottom = 2; |
236 |
|
newInsets.right = 3; |
237 |
|
} |
238 |
|
return newInsets; |
239 |
|
} |
240 |
|
|
241 |
|
/** |
242 |
|
* Paints the border for the specified component. |
243 |
|
* |
244 |
|
* @param c the component. |
245 |
|
* @param g the graphics device. |
246 |
|
* @param x the x-coordinate. |
247 |
|
* @param y the y-coordinate. |
248 |
|
* @param w the width. |
249 |
|
* @param h the height. |
250 |
|
*/ |
251 |
|
public void paintBorder(Component c, Graphics g, int x, int y, int w, |
252 |
|
int h) |
253 |
|
{ |
254 |
|
g.setColor(MetalLookAndFeel.getControlDarkShadow()); |
255 |
|
g.drawRect(x, y, w - 1, h - 1); |
256 |
|
} |
257 |
|
|
258 |
|
} |
259 |
|
|
260 |
|
/** |
261 |
* A simple 3D border. |
* A simple 3D border. |
262 |
*/ |
*/ |
263 |
public static class Flush3DBorder extends AbstractBorder |
public static class Flush3DBorder extends AbstractBorder |
535 |
g.drawLine(x + w - 3, y + 14, x + w - 3, y + h - 15); |
g.drawLine(x + w - 3, y + 14, x + w - 3, y + h - 15); |
536 |
|
|
537 |
// draw the line highlights |
// draw the line highlights |
538 |
g.setColor(MetalLookAndFeel.getControl()); |
if (f.isSelected()) |
539 |
|
g.setColor(MetalLookAndFeel.getPrimaryControlShadow()); |
540 |
|
else |
541 |
|
g.setColor(MetalLookAndFeel.getControlShadow()); |
542 |
g.drawLine(x + 15, y + 3, x + w - 14, y + 3); |
g.drawLine(x + 15, y + 3, x + w - 14, y + 3); |
543 |
g.drawLine(x + 15, y + h - 2, x + w - 14, y + h - 2); |
g.drawLine(x + 15, y + h - 2, x + w - 14, y + h - 2); |
544 |
g.drawLine(x + 3, y + 15, x + 3, y + h - 14); |
g.drawLine(x + 3, y + 15, x + 3, y + h - 14); |
937 |
} |
} |
938 |
return buttonBorder; |
return buttonBorder; |
939 |
} |
} |
940 |
|
|
941 |
|
/** |
942 |
|
* Returns a border instance that is used with a {@link JInternalFrame} when |
943 |
|
* it is in the iconified state. |
944 |
|
* |
945 |
|
* @return A border. |
946 |
|
* |
947 |
|
* @since 1.3 |
948 |
|
*/ |
949 |
|
public static Border getDesktopIconBorder() |
950 |
|
{ |
951 |
|
if (desktopIconBorder == null) |
952 |
|
desktopIconBorder = new DesktopIconBorder(); |
953 |
|
return desktopIconBorder; |
954 |
|
} |
955 |
|
|
956 |
/** |
/** |
957 |
* Returns a border for use by the {@link JTextField} component. |
* Returns a border for use by the {@link JTextField} component. |