60 |
* @serial |
* @serial |
61 |
* @serialField delegate Border the <code>Border</code> wrapped |
* @serialField delegate Border the <code>Border</code> wrapped |
62 |
* |
* |
63 |
* @author Brian Jones |
* @author Brian Jones (cbj@gnu.org) |
64 |
* @author Sascha Brawer |
* @author Sascha Brawer (brawer@dandelis.ch) |
65 |
*/ |
*/ |
66 |
public class BorderUIResource |
public class BorderUIResource |
67 |
extends Object |
extends Object |
68 |
implements Border, UIResource, Serializable |
implements Border, UIResource, Serializable |
69 |
{ |
{ |
70 |
|
/** |
71 |
|
* Verified using the <code>serialver</code> tool |
72 |
|
* of Apple/Sun JDK 1.3.1 on MacOS X 10.1.5. |
73 |
|
*/ |
74 |
static final long serialVersionUID = -3440553684010079691L; |
static final long serialVersionUID = -3440553684010079691L; |
75 |
|
|
76 |
|
|
254 |
} |
} |
255 |
|
|
256 |
|
|
257 |
|
/** |
258 |
|
* A {@link javax.swing.border.BevelBorder} that also implements the |
259 |
|
* {@link UIResource} marker interface. This is useful for |
260 |
|
* implementing pluggable look-and-feels: When switching the current |
261 |
|
* LookAndFeel, only those borders are replaced that are marked as |
262 |
|
* {@link UIResource}. For this reason, a look-and-feel should |
263 |
|
* always install borders that implement <code>UIResource</code>, |
264 |
|
* such as the borders provided by this class. |
265 |
|
* |
266 |
|
* @author Brian Jones (cbj@gnu.org) |
267 |
|
* @author Sascha Brawer (brawer@dandelis.ch) |
268 |
|
*/ |
269 |
|
public static class BevelBorderUIResource |
270 |
|
extends BevelBorder |
271 |
|
implements UIResource, Serializable |
272 |
|
{ |
273 |
/** |
/** |
274 |
* @serial |
* Constructs a BevelBorderUIResource whose colors will be derived |
275 |
|
* from the background of the enclosed component. The background |
276 |
|
* color is retrieved each time the border is painted, so a border |
277 |
|
* constructed by this method will automatically reflect a change |
278 |
|
* to the component’s background color. |
279 |
|
* |
280 |
|
* <p><img src="../border/BevelBorder-1.png" width="500" height="150" |
281 |
|
* alt="[An illustration showing raised and lowered BevelBorders]" /> |
282 |
|
* |
283 |
|
* @param bevelType the desired appearance of the border. The value |
284 |
|
* must be either {@link javax.swing.border.BevelBorder#RAISED} |
285 |
|
* or {@link javax.swing.border.BevelBorder#LOWERED}. |
286 |
|
* |
287 |
|
* @throws IllegalArgumentException if <code>bevelType</code> has |
288 |
|
* an unsupported value. |
289 |
*/ |
*/ |
290 |
public static class BevelBorderUIResource |
public BevelBorderUIResource(int bevelType) |
291 |
extends BevelBorder |
{ |
292 |
implements UIResource, Serializable |
super(bevelType); |
293 |
|
} |
294 |
|
|
295 |
|
|
296 |
|
/** |
297 |
|
* Constructs a BevelBorderUIResource given its appearance type |
298 |
|
* and two colors for its highlight and shadow. |
299 |
|
* |
300 |
|
* <p><img src="../border/BevelBorder-2.png" width="500" height="150" |
301 |
|
* alt="[An illustration showing BevelBorders that were constructed |
302 |
|
* with this method]" /> |
303 |
|
* |
304 |
|
* @param bevelType the desired appearance of the border. The value |
305 |
|
* must be either {@link javax.swing.border.BevelBorder#RAISED} |
306 |
|
* or {@link javax.swing.border.BevelBorder#LOWERED}. |
307 |
|
* |
308 |
|
* @param highlight the color that will be used for the inner side |
309 |
|
* of the highlighted edges (top and left if if |
310 |
|
* <code>bevelType</code> is {@link |
311 |
|
* javax.swing.border.BevelBorder#RAISED}; bottom and right |
312 |
|
* otherwise). The color for the outer side is a brightened |
313 |
|
* version of this color. |
314 |
|
* |
315 |
|
* @param shadow the color that will be used for the outer side of |
316 |
|
* the shadowed edges (bottom and right if |
317 |
|
* <code>bevelType</code> is {@link |
318 |
|
* javax.swing.border.BevelBorder#RAISED}; top and left |
319 |
|
* otherwise). The color for the inner side is a brightened |
320 |
|
* version of this color. |
321 |
|
* |
322 |
|
* @throws IllegalArgumentException if <code>bevelType</code> has |
323 |
|
* an unsupported value. |
324 |
|
* |
325 |
|
* @throws NullPointerException if <code>highlight</code> or |
326 |
|
* <code>shadow</code> is <code>null</code>. |
327 |
|
*/ |
328 |
|
public BevelBorderUIResource(int bevelType, |
329 |
|
Color highlight, |
330 |
|
Color shadow) |
331 |
{ |
{ |
332 |
public BevelBorderUIResource(int bevelType) |
super(bevelType, highlight, shadow); |
|
{ |
|
|
super (bevelType); |
|
|
} |
|
|
|
|
|
public BevelBorderUIResource(int bevelType, |
|
|
Color highlight, |
|
|
Color shadow) |
|
|
{ |
|
|
super (bevelType, highlight, shadow); |
|
|
} |
|
|
public BevelBorderUIResource(int bevelType, |
|
|
Color highlightOuter, |
|
|
Color highlightInner, |
|
|
Color shadowOuter, |
|
|
Color shadowInner) |
|
|
{ |
|
|
super (bevelType, highlightOuter, highlightInner, shadowOuter, |
|
|
shadowInner); |
|
|
} |
|
333 |
} |
} |
334 |
|
|
335 |
|
|
336 |
/** |
/** |
337 |
* @serial |
* Constructs a BevelBorderUIResource given its appearance type |
338 |
|
* and all its colors. |
339 |
|
* |
340 |
|
* <p><img src="../border/BevelBorder-3.png" width="500" height="150" |
341 |
|
* alt="[An illustration showing BevelBorders that were constructed |
342 |
|
* with this method]" /> |
343 |
|
* |
344 |
|
* @param bevelType the desired appearance of the border. The value |
345 |
|
* must be either {@link javax.swing.border.BevelBorder#RAISED} |
346 |
|
* or {@link javax.swing.border.BevelBorder#LOWERED}. |
347 |
|
* |
348 |
|
* @param highlightOuter the color that will be used for the outer |
349 |
|
* side of the highlighted edges (top and left if |
350 |
|
* <code>bevelType</code> is {@link |
351 |
|
* javax.swing.border.BevelBorder#RAISED}; bottom and right |
352 |
|
* otherwise). |
353 |
|
* |
354 |
|
* @param highlightInner the color that will be used for the inner |
355 |
|
* side of the highlighted edges. |
356 |
|
* |
357 |
|
* @param shadowOuter the color that will be used for the outer |
358 |
|
* side of the shadowed edges (bottom and right if |
359 |
|
* <code>bevelType</code> is {@link |
360 |
|
* javax.swing.border.BevelBorder#RAISED}; top and left |
361 |
|
* otherwise). |
362 |
|
* |
363 |
|
* @param shadowInner the color that will be used for the inner |
364 |
|
* side of the shadowed edges. |
365 |
|
* |
366 |
|
* @throws IllegalArgumentException if <code>bevelType</code> has |
367 |
|
* an unsupported value. |
368 |
|
* |
369 |
|
* @throws NullPointerException if one of the passed colors |
370 |
|
* is <code>null</code>. |
371 |
*/ |
*/ |
372 |
|
public BevelBorderUIResource(int bevelType, |
373 |
|
Color highlightOuter, |
374 |
|
Color highlightInner, |
375 |
|
Color shadowOuter, |
376 |
|
Color shadowInner) |
377 |
|
{ |
378 |
|
super(bevelType, |
379 |
|
highlightOuter, highlightInner, |
380 |
|
shadowOuter, shadowInner); |
381 |
|
} |
382 |
|
} |
383 |
|
|
384 |
|
/** |
385 |
|
* @serial */ |
386 |
public static class CompoundBorderUIResource |
public static class CompoundBorderUIResource |
387 |
extends CompoundBorder |
extends CompoundBorder |
388 |
implements UIResource, Serializable |
implements UIResource, Serializable |