Merge from mainline (gomp-merge-2005-02-26).
[official-gcc.git] / libjava / javax / swing / plaf / BorderUIResource.java
blob6b61f48a090b4418f9c25fd8b43b9b4115e11019
1 /* BorderUIResource.java
2 Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
4 This file is part of GNU Classpath.
6 GNU Classpath is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
9 any later version.
11 GNU Classpath is distributed in the hope that it will be useful, but
12 WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with GNU Classpath; see the file COPYING. If not, write to the
18 Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
19 02111-1307 USA.
21 Linking this library statically or dynamically with other modules is
22 making a combined work based on this library. Thus, the terms and
23 conditions of the GNU General Public License cover the whole
24 combination.
26 As a special exception, the copyright holders of this library give you
27 permission to link this library with independent modules to produce an
28 executable, regardless of the license terms of these independent
29 modules, and to copy and distribute the resulting executable under
30 terms of your choice, provided that you also meet, for each linked
31 independent module, the terms and conditions of the license of that
32 module. An independent module is a module which is not derived from
33 or based on this library. If you modify this library, you may extend
34 this exception to your version of the library, but you are not
35 obligated to do so. If you do not wish to do so, delete this
36 exception statement from your version. */
39 package javax.swing.plaf;
41 import java.awt.Color;
42 import java.awt.Component;
43 import java.awt.Font;
44 import java.awt.Graphics;
45 import java.awt.Insets;
46 import java.io.Serializable;
48 import javax.swing.Icon;
49 import javax.swing.border.BevelBorder;
50 import javax.swing.border.Border;
51 import javax.swing.border.CompoundBorder;
52 import javax.swing.border.EmptyBorder;
53 import javax.swing.border.EtchedBorder;
54 import javax.swing.border.LineBorder;
55 import javax.swing.border.MatteBorder;
56 import javax.swing.border.TitledBorder;
58 /**
59 * A wrapper for {@link javax.swing.border.Border} that also
60 * implements the {@link UIResource} marker interface. This is useful
61 * for implementing pluggable look-and-feels: When switching the
62 * current LookAndFeel, only those borders are replaced that are
63 * marked as {@link UIResource}. For this reason, a look-and-feel
64 * should always install borders that implement
65 * <code>UIResource</code>, such as the borders provided by this
66 * class.
68 * @serial
69 * @serialField delegate Border the <code>Border</code> wrapped
71 * @author Brian Jones (cbj@gnu.org)
72 * @author Sascha Brawer (brawer@dandelis.ch)
74 public class BorderUIResource
75 extends Object
76 implements Border, UIResource, Serializable
78 /**
79 * Verified using the <code>serialver</code> tool
80 * of Apple/Sun JDK 1.3.1 on MacOS X 10.1.5.
82 static final long serialVersionUID = -3440553684010079691L;
85 /**
86 * A shared instance of an {@link EtchedBorderUIResource}, or
87 * <code>null</code> if the {@link #getEtchedBorderUIResource()}
88 * method has not yet been called.
90 private static Border etchedBorderUIResource;
93 /**
94 * A shared instance of a {@link BevelBorderUIResource} whose
95 * <code>bevelType</code> is {@link
96 * javax.swing.border.BevelBorder#LOWERED}, or <code>null</code> if
97 * the {@link #getLoweredBevelBorderUIResource()} has not yet been
98 * called.
100 private static Border loweredBevelBorderUIResource;
104 * A shared instance of a {@link BevelBorderUIResource} whose
105 * <code>bevelType</code> is {@link
106 * javax.swing.border.BevelBorder#RAISED}, or <code>null</code> if
107 * the {@link #getRaisedBevelBorderUIResource()} has not yet been
108 * called.
110 private static Border raisedBevelBorderUIResource;
114 * A shared instance of a {@link LineBorderUIResource} for
115 * a one-pixel thick black line, or <code>null</code> if
116 * the {@link #getBlackLineBorderUIResource()} has not yet been
117 * called.
119 private static Border blackLineBorderUIResource;
123 * Returns a shared instance of an etched border which also
124 * is marked as an {@link UIResource}.
126 * @see javax.swing.border.EtchedBorder
128 public static Border getEtchedBorderUIResource()
130 /* Swing is not designed to be thread-safe, so there is no
131 * need to synchronize the access to the global variable.
133 if (etchedBorderUIResource == null)
134 etchedBorderUIResource = new EtchedBorderUIResource();
135 return etchedBorderUIResource;
140 * Returns a shared instance of {@link BevelBorderUIResource} whose
141 * <code>bevelType</code> is {@link
142 * javax.swing.border.BevelBorder#LOWERED}.
144 * @see javax.swing.border.BevelBorder
146 public static Border getLoweredBevelBorderUIResource()
148 /* Swing is not designed to be thread-safe, so there is no
149 * need to synchronize the access to the global variable.
151 if (loweredBevelBorderUIResource == null)
152 loweredBevelBorderUIResource = new BevelBorderUIResource(
153 BevelBorder.LOWERED);
154 return loweredBevelBorderUIResource;
159 * Returns a shared instance of {@link BevelBorderUIResource} whose
160 * <code>bevelType</code> is {@link
161 * javax.swing.border.BevelBorder#RAISED}.
163 * @see javax.swing.border.BevelBorder
165 public static Border getRaisedBevelBorderUIResource()
167 /* Swing is not designed to be thread-safe, so there is no
168 * need to synchronize the access to the global variable.
170 if (raisedBevelBorderUIResource == null)
171 raisedBevelBorderUIResource = new BevelBorderUIResource(
172 BevelBorder.RAISED);
173 return raisedBevelBorderUIResource;
178 * Returns a shared instance of {@link LineBorderUIResource} for
179 * a black, one-pixel width border.
181 * @see javax.swing.border.LineBorder
183 public static Border getBlackLineBorderUIResource()
185 /* Swing is not designed to be thread-safe, so there is no
186 * need to synchronize the access to the global variable.
188 if (blackLineBorderUIResource == null)
189 blackLineBorderUIResource = new LineBorderUIResource(Color.black);
190 return blackLineBorderUIResource;
195 * The wrapped border.
197 private Border delegate;
201 * Constructs a <code>BorderUIResource</code> for wrapping
202 * a <code>Border</code> object.
204 * @param delegate the border to be wrapped.
206 public BorderUIResource(Border delegate)
208 if (delegate == null)
209 throw new IllegalArgumentException();
211 this.delegate = delegate;
216 * Paints the border around an enclosed component by calling
217 * the <code>paintBorder</code> method of the wrapped delegate.
219 * @param c the component whose border is to be painted.
220 * @param g the graphics for painting.
221 * @param x the horizontal position for painting the border.
222 * @param y the vertical position for painting the border.
223 * @param width the width of the available area for painting the border.
224 * @param height the height of the available area for painting the border.
226 public void paintBorder(Component c, Graphics g,
227 int x, int y, int width, int height)
229 delegate.paintBorder(c, g, x, y, width, height);
234 * Measures the width of this border by calling the
235 * <code>getBorderInsets</code> method of the wrapped
236 * delegate.
238 * @param c the component whose border is to be measured.
240 * @return an Insets object whose <code>left</code>, <code>right</code>,
241 * <code>top</code> and <code>bottom</code> fields indicate the
242 * width of the border at the respective edge.
244 public Insets getBorderInsets(Component c)
246 return delegate.getBorderInsets(c);
251 * Determines whether this border fills every pixel in its area
252 * when painting by calling the <code>isBorderOpaque</code>
253 * method of the wrapped delegate.
255 * @return <code>true</code> if the border is fully opaque, or
256 * <code>false</code> if some pixels of the background
257 * can shine through the border.
259 public boolean isBorderOpaque()
261 return delegate.isBorderOpaque();
266 * A {@link javax.swing.border.BevelBorder} that also implements the
267 * {@link UIResource} marker interface. This is useful for
268 * implementing pluggable look-and-feels: When switching the current
269 * LookAndFeel, only those borders are replaced that are marked as
270 * {@link UIResource}. For this reason, a look-and-feel should
271 * always install borders that implement <code>UIResource</code>,
272 * such as the borders provided by this class.
274 * @author Brian Jones (cbj@gnu.org)
275 * @author Sascha Brawer (brawer@dandelis.ch)
277 public static class BevelBorderUIResource
278 extends BevelBorder
279 implements UIResource, Serializable
281 private static final long serialVersionUID = -1275542891108351642L;
284 * Constructs a BevelBorderUIResource whose colors will be derived
285 * from the background of the enclosed component. The background
286 * color is retrieved each time the border is painted, so a border
287 * constructed by this method will automatically reflect a change
288 * to the component&#x2019;s background color.
290 * <p><img src="../border/doc-files/BevelBorder-1.png"
291 * width="500" height="150"
292 * alt="[An illustration showing raised and lowered BevelBorders]" /></p>
294 * @param bevelType the desired appearance of the border. The value
295 * must be either {@link javax.swing.border.BevelBorder#RAISED}
296 * or {@link javax.swing.border.BevelBorder#LOWERED}.
298 * @throws IllegalArgumentException if <code>bevelType</code> has
299 * an unsupported value.
301 public BevelBorderUIResource(int bevelType)
303 super(bevelType);
308 * Constructs a BevelBorderUIResource given its appearance type
309 * and two colors for its highlight and shadow.
311 * <p><img src="../border/doc-files/BevelBorder-2.png" width="500"
312 * height="150" alt="[An illustration showing BevelBorders that were
313 * constructed with this method]" /></p>
315 * @param bevelType the desired appearance of the border. The value
316 * must be either {@link javax.swing.border.BevelBorder#RAISED}
317 * or {@link javax.swing.border.BevelBorder#LOWERED}.
319 * @param highlight the color that will be used for the inner side
320 * of the highlighted edges (top and left if if
321 * <code>bevelType</code> is {@link
322 * javax.swing.border.BevelBorder#RAISED}; bottom and right
323 * otherwise). The color for the outer side is a brightened
324 * version of this color.
326 * @param shadow the color that will be used for the outer side of
327 * the shadowed edges (bottom and right if
328 * <code>bevelType</code> is {@link
329 * javax.swing.border.BevelBorder#RAISED}; top and left
330 * otherwise). The color for the inner side is a brightened
331 * version of this color.
333 * @throws IllegalArgumentException if <code>bevelType</code> has
334 * an unsupported value.
336 * @throws NullPointerException if <code>highlight</code> or
337 * <code>shadow</code> is <code>null</code>.
339 public BevelBorderUIResource(int bevelType,
340 Color highlight,
341 Color shadow)
343 super(bevelType, highlight, shadow);
348 * Constructs a BevelBorderUIResource given its appearance type
349 * and all its colors.
351 * <p><img src="../border/doc-files/BevelBorder-3.png" width="500"
352 * height="150" alt="[An illustration showing BevelBorders that
353 * were constructed with this method]" /></p>
355 * @param bevelType the desired appearance of the border. The value
356 * must be either {@link javax.swing.border.BevelBorder#RAISED}
357 * or {@link javax.swing.border.BevelBorder#LOWERED}.
359 * @param highlightOuter the color that will be used for the outer
360 * side of the highlighted edges (top and left if
361 * <code>bevelType</code> is {@link
362 * javax.swing.border.BevelBorder#RAISED}; bottom and right
363 * otherwise).
365 * @param highlightInner the color that will be used for the inner
366 * side of the highlighted edges.
368 * @param shadowOuter the color that will be used for the outer
369 * side of the shadowed edges (bottom and right if
370 * <code>bevelType</code> is {@link
371 * javax.swing.border.BevelBorder#RAISED}; top and left
372 * otherwise).
374 * @param shadowInner the color that will be used for the inner
375 * side of the shadowed edges.
377 * @throws IllegalArgumentException if <code>bevelType</code> has
378 * an unsupported value.
380 * @throws NullPointerException if one of the passed colors
381 * is <code>null</code>.
383 public BevelBorderUIResource(int bevelType,
384 Color highlightOuter,
385 Color highlightInner,
386 Color shadowOuter,
387 Color shadowInner)
389 super(bevelType,
390 highlightOuter, highlightInner,
391 shadowOuter, shadowInner);
397 * A {@link javax.swing.border.CompoundBorder} that also implements the
398 * {@link UIResource} marker interface. This is useful for
399 * implementing pluggable look-and-feels: When switching the current
400 * LookAndFeel, only those borders are replaced that are marked as
401 * {@link UIResource}. For this reason, a look-and-feel should
402 * always install borders that implement <code>UIResource</code>,
403 * such as the borders provided by this class.
405 * @author Brian Jones (cbj@gnu.org)
406 * @author Sascha Brawer (brawer@dandelis.ch)
408 public static class CompoundBorderUIResource
409 extends CompoundBorder
410 implements UIResource, Serializable
412 private static final long serialVersionUID = 7550017084975167341L;
415 * Constructs a CompoundBorderUIResource with the specified inside
416 * and outside borders.
418 * @param outsideBorder the outside border, which is painted to the
419 * outside of both <code>insideBorder</code> and the enclosed
420 * component. It is acceptable to pass <code>null</code>, in
421 * which case no outside border is painted.
423 * @param insideBorder the inside border, which is painted to
424 * between <code>outsideBorder</code> and the enclosed
425 * component. It is acceptable to pass <code>null</code>, in
426 * which case no inside border is painted.
428 public CompoundBorderUIResource(Border outsideBorder,
429 Border insideBorder)
431 super(outsideBorder, insideBorder);
437 * An {@link javax.swing.border.EmptyBorder} that also implements the
438 * {@link UIResource} marker interface. This is useful for
439 * implementing pluggable look-and-feels: When switching the current
440 * LookAndFeel, only those borders are replaced that are marked as
441 * {@link UIResource}. For this reason, a look-and-feel should
442 * always install borders that implement <code>UIResource</code>,
443 * such as the borders provided by this class.
445 * <p><img src="../border/doc-files/EmptyBorder-1.png"
446 * width="290" height="200"
447 * alt="[An illustration of EmptyBorder]" /></p>
449 * @author Brian Jones (cbj@gnu.org)
450 * @author Sascha Brawer (brawer@dandelis.ch)
452 public static class EmptyBorderUIResource
453 extends EmptyBorder
454 implements UIResource, Serializable
456 private static final long serialVersionUID = -4914187529340071708L;
459 * Constructs an empty border given the number of pixels required
460 * on each side.
462 * @param top the number of pixels that the border will need
463 * for its top edge.
465 * @param left the number of pixels that the border will need
466 * for its left edge.
468 * @param bottom the number of pixels that the border will need
469 * for its bottom edge.
471 * @param right the number of pixels that the border will need
472 * for its right edge.
474 public EmptyBorderUIResource(int top, int left, int bottom, int right)
476 super(top, left, bottom, right);
481 * Constructs an empty border given the number of pixels required
482 * on each side, passed in an Insets object.
484 * @param insets the Insets for the new border.
486 public EmptyBorderUIResource(Insets insets)
488 super(insets);
494 * An {@link javax.swing.border.EtchedBorder} that also implements the
495 * {@link UIResource} marker interface. This is useful for
496 * implementing pluggable look-and-feels: When switching the current
497 * LookAndFeel, only those borders are replaced that are marked as
498 * {@link UIResource}. For this reason, a look-and-feel should
499 * always install borders that implement <code>UIResource</code>,
500 * such as the borders provided by this class.
502 * <p><img src="../border/doc-files/EtchedBorder-1.png" width="500"
503 * height="200" alt="[An illustration of the two EtchedBorder
504 * variants]" /></p>
506 * @author Brian Jones (cbj@gnu.org)
507 * @author Sascha Brawer (brawer@dandelis.ch)
509 public static class EtchedBorderUIResource
510 extends EtchedBorder
511 implements UIResource, Serializable
513 private static final long serialVersionUID = -8186391754165296656L;
516 * Constructs an EtchedBorderUIResource that appears lowered into
517 * the surface. The colors will be derived from the background
518 * color of the enclosed Component when the border gets painted.
520 public EtchedBorderUIResource()
522 super();
527 * Constructs an EtchedBorderUIResource with the specified
528 * appearance. The colors will be derived from the background
529 * color of the enclosed Component when the border gets painted.
531 * <p><img src="../border/doc-files/EtchedBorder-1.png"
532 * width="500" height="200" alt="[An illustration of the two
533 * EtchedBorder variants]" /></p>
535 * @param etchType the desired appearance of the border. The value
536 * must be either {@link javax.swing.border.EtchedBorder#RAISED}
537 * or {@link javax.swing.border.EtchedBorder#LOWERED}.
539 * @throws IllegalArgumentException if <code>etchType</code> has
540 * an unsupported value.
542 public EtchedBorderUIResource(int etchType)
544 super(etchType);
549 * Constructs a lowered EtchedBorderUIResource, explicitly
550 * selecting the colors that will be used for highlight and
551 * shadow.
553 * @param highlight the color that will be used for painting
554 * the highlight part of the border.
556 * @param shadow the color that will be used for painting
557 * the shadow part of the border.
559 * @see #EtchedBorderUIResource(int, Color, Color)
561 public EtchedBorderUIResource(Color highlight, Color shadow)
563 super(highlight, shadow);
568 * Constructs an EtchedBorderUIResource with the specified
569 * appearance, explicitly selecting the colors that will be used
570 * for highlight and shadow.
572 * <p><img src="../border/doc-files/EtchedBorder-2.png" width="500"
573 * height="200" alt="[An illustration that shows which pixels get
574 * painted in what color]" /></p>
576 * @param etchType the desired appearance of the border. The value
577 * must be either {@link javax.swing.border.EtchedBorder#RAISED}
578 * or {@link javax.swing.border.EtchedBorder#LOWERED}.
580 * @param highlight the color that will be used for painting
581 * the highlight part of the border.
583 * @param shadow the color that will be used for painting
584 * the shadow part of the border.
586 * @throws IllegalArgumentException if <code>etchType</code> has
587 * an unsupported value.
589 public EtchedBorderUIResource(int etchType,
590 Color highlight, Color shadow)
592 super(etchType, highlight, shadow);
598 * A {@link javax.swing.border.LineBorder} that also implements the
599 * {@link UIResource} marker interface. This is useful for
600 * implementing pluggable look-and-feels: When switching the current
601 * LookAndFeel, only those borders are replaced that are marked as
602 * {@link UIResource}. For this reason, a look-and-feel should
603 * always install borders that implement <code>UIResource</code>,
604 * such as the borders provided by this class.
606 * <p><img src="../border/doc-files/LineBorder-1.png" width="500"
607 * height="200" alt="[An illustration of two LineBorders]" /></p>
609 * @author Brian Jones (cbj@gnu.org)
610 * @author Sascha Brawer (brawer@dandelis.ch)
612 public static class LineBorderUIResource
613 extends LineBorder
614 implements UIResource, Serializable
616 private static final long serialVersionUID = -6171232338180172310L;
619 * Constructs a LineBorderUIResource given its color. The border
620 * will be one pixel thick and have plain corners.
622 * @param color the color for drawing the border.
624 public LineBorderUIResource(Color color)
626 super(color);
631 * Constructs a LineBorder given its color and thickness. The
632 * border will have plain corners.
634 * @param color the color for drawing the border.
635 * @param thickness the width of the line in pixels.
637 public LineBorderUIResource(Color color, int thickness)
639 super(color, thickness);
643 /* Note: Since JDK1.3, javax.swing.border.LineBorder also has a
644 * constructor which accepts a value for the roundedCorners
645 * property. However, as of JDK1.4.1, the LineBorderUIResource
646 * subclass does not have a corresponding constructor.
648 * A request for enhancing the Swing API has been filed with Sun:
649 * http://developer.java.sun.com/developer/bugParade/bugs/4879999.html
655 * A {@link javax.swing.border.MatteBorder} that also implements the
656 * {@link UIResource} marker interface. This is useful for
657 * implementing pluggable look-and-feels: When switching the current
658 * LookAndFeel, only those borders are replaced that are marked as
659 * {@link UIResource}. For this reason, a look-and-feel should
660 * always install borders that implement <code>UIResource</code>,
661 * such as the borders provided by this class.
663 * <p><img src="../border/doc-files/MatteBorder-1.png" width="500"
664 * height="150" alt="[An illustration of two MatteBorders]" /></p>
666 * @author Brian Jones (cbj@gnu.org)
667 * @author Sascha Brawer (brawer@dandelis.ch)
669 public static class MatteBorderUIResource
670 extends MatteBorder
671 implements UIResource, Serializable
673 private static final long serialVersionUID = -8107923147541851122L;
676 * Constructs a MatteBorderUIResource given the width on each side
677 * and a fill color.
679 * <p><img src="../border/doc-files/MatteBorder-2.png" width="500"
680 * height="150" alt="[A picture of a MatteBorder made by this
681 * constructor]" /></p>
683 * @param top the width of the border at its top edge.
684 * @param left the width of the border at its left edge.
685 * @param bottom the width of the border at its bottom edge.
686 * @param right the width of the border at its right edge.
687 * @param matteColor the color for filling the border.
689 public MatteBorderUIResource(int top, int left,
690 int bottom, int right,
691 Color color)
693 super(top, left, bottom, right, color);
698 * Constructs a MatteBorderUIResource given the width on each side
699 * and an icon for tiling the border area.
701 * <p><img src="../border/doc-files/MatteBorder-4.png" width="500"
702 * height="150" alt="[A picture of a MatteBorder made by this
703 * constructor]" /></p>
705 * @param top the width of the border at its top edge.
706 * @param left the width of the border at its left edge.
707 * @param bottom the width of the border at its bottom edge.
708 * @param right the width of the border at its right edge.
709 * @param tileIcon an icon for tiling the border area.
711 public MatteBorderUIResource(int top, int left,
712 int bottom, int right,
713 Icon tileIcon)
715 super(top, left, bottom, right, tileIcon);
720 * Constructs a MatteBorderUIResource given an icon for tiling the
721 * border area. The icon width is used for the border insets at
722 * the left and right edge, the icon height for the top and bottom
723 * edge.
725 * <p><img src="../border/doc-files/MatteBorder-6.png" width="500"
726 * height="150" alt="[A picture of a MatteBorder made by this
727 * constructor]" /></p>
729 * @param tileIcon an icon for tiling the border area.
731 public MatteBorderUIResource(Icon tileIcon)
733 super(tileIcon);
739 * A {@link javax.swing.border.TitledBorder} that also implements the
740 * {@link UIResource} marker interface. This is useful for
741 * implementing pluggable look-and-feels: When switching the current
742 * LookAndFeel, only those borders are replaced that are marked as
743 * {@link UIResource}. For this reason, a look-and-feel should
744 * always install borders that implement <code>UIResource</code>,
745 * such as the borders provided by this class.
747 * @author Brian Jones (cbj@gnu.org)
748 * @author Sascha Brawer (brawer@dandelis.ch)
750 public static class TitledBorderUIResource
751 extends TitledBorder
752 implements UIResource, Serializable
754 private static final long serialVersionUID = 7667113547406407427L;
757 * Constructs a TitledBorderUIResource given the text of its title.
759 * @param title the title text, or <code>null</code> to use no
760 * title text.
762 public TitledBorderUIResource(String title)
764 super(title);
769 * Constructs an initially untitled TitledBorderUIResource
770 * given another border.
772 * @param border the border underneath the title, or
773 * <code>null</code> to use a default from
774 * the current look and feel.
776 public TitledBorderUIResource(Border border)
778 super(border);
783 * Constructs a TitledBorder given its border and title text.
785 * @param border the border underneath the title, or
786 * <code>null</code> to use a default from
787 * the current look and feel.
789 * @param title the title text, or <code>null</code>
790 * to use no title text.
792 public TitledBorderUIResource(Border border, String title)
794 super(border, title);
799 * Constructs a TitledBorderUIResource given its border, title
800 * text, horizontal alignment, and vertical position.
802 * @param border the border underneath the title, or
803 * <code>null</code> to use a default
804 * from the current look and feel.
806 * @param title the title text, or <code>null</code>
807 * to use no title text.
809 * @param titleJustification the horizontal alignment of the title
810 * text in relation to the border. The value must be one of
811 * {@link javax.swing.border.TitledBorder#LEFT},
812 * {@link javax.swing.border.TitledBorder#CENTER},
813 * {@link javax.swing.border.TitledBorder#RIGHT},
814 * {@link javax.swing.border.TitledBorder#LEADING},
815 * {@link javax.swing.border.TitledBorder#TRAILING}, or
816 * {@link javax.swing.border.TitledBorder#DEFAULT_JUSTIFICATION}.
818 * @param titlePosition the vertical position of the title text
819 * in relation to the border. The value must be one of
820 * {@link javax.swing.border.TitledBorder#ABOVE_TOP},
821 * {@link javax.swing.border.TitledBorder#TOP},
822 * {@link javax.swing.border.TitledBorder#BELOW_TOP},
823 * {@link javax.swing.border.TitledBorder#ABOVE_BOTTOM},
824 * {@link javax.swing.border.TitledBorder#BOTTOM},
825 * {@link javax.swing.border.TitledBorder#BELOW_BOTTOM},
826 * or {@link javax.swing.border.TitledBorder#DEFAULT_POSITION}.
828 * @throws IllegalArgumentException if <code>titleJustification</code>
829 * or <code>titlePosition</code> have an unsupported value.
831 public TitledBorderUIResource(Border border, String title,
832 int titleJustification,
833 int titlePosition)
835 super(border, title, titleJustification, titlePosition);
840 * Constructs a TitledBorder given its border, title text,
841 * horizontal alignment, vertical position, and font.
843 * @param border the border underneath the title, or
844 * <code>null</code> to use a default
845 * from the current look and feel.
847 * @param title the title text, or <code>null</code>
848 * to use no title text.
850 * @param titleJustification the horizontal alignment of the title
851 * text in relation to the border. The value must be one of
852 * {@link javax.swing.border.TitledBorder#LEFT},
853 * {@link javax.swing.border.TitledBorder#CENTER},
854 * {@link javax.swing.border.TitledBorder#RIGHT},
855 * {@link javax.swing.border.TitledBorder#LEADING},
856 * {@link javax.swing.border.TitledBorder#TRAILING}, or
857 * {@link javax.swing.border.TitledBorder#DEFAULT_JUSTIFICATION}.
859 * @param titlePosition the vertical position of the title text
860 * in relation to the border. The value must be one of
861 * {@link javax.swing.border.TitledBorder#ABOVE_TOP},
862 * {@link javax.swing.border.TitledBorder#TOP},
863 * {@link javax.swing.border.TitledBorder#BELOW_TOP},
864 * {@link javax.swing.border.TitledBorder#ABOVE_BOTTOM},
865 * {@link javax.swing.border.TitledBorder#BOTTOM},
866 * {@link javax.swing.border.TitledBorder#BELOW_BOTTOM},
867 * or {@link javax.swing.border.TitledBorder#DEFAULT_POSITION}.
869 * @param titleFont the font for the title text, or <code>null</code>
870 * to use a default from the current look and feel.
872 * @throws IllegalArgumentException if <code>titleJustification</code>
873 * or <code>titlePosition</code> have an unsupported value.
875 public TitledBorderUIResource(Border border, String title,
876 int titleJustification,
877 int titlePosition,
878 Font titleFont)
880 super(border, title, titleJustification, titlePosition,
881 titleFont);
886 * Constructs a TitledBorder given its border, title text,
887 * horizontal alignment, vertical position, font, and color.
889 * @param border the border underneath the title, or
890 * <code>null</code> to use a default
891 * from the current look and feel.
893 * @param title the title text, or <code>null</code>
894 * to use no title text.
896 * @param titleJustification the horizontal alignment of the title
897 * text in relation to the border. The value must be one of
898 * {@link javax.swing.border.TitledBorder#LEFT},
899 * {@link javax.swing.border.TitledBorder#CENTER},
900 * {@link javax.swing.border.TitledBorder#RIGHT},
901 * {@link javax.swing.border.TitledBorder#LEADING},
902 * {@link javax.swing.border.TitledBorder#TRAILING}, or
903 * {@link javax.swing.border.TitledBorder#DEFAULT_JUSTIFICATION}.
905 * @param titlePosition the vertical position of the title text
906 * in relation to the border. The value must be one of
907 * {@link javax.swing.border.TitledBorder#ABOVE_TOP},
908 * {@link javax.swing.border.TitledBorder#TOP},
909 * {@link javax.swing.border.TitledBorder#BELOW_TOP},
910 * {@link javax.swing.border.TitledBorder#ABOVE_BOTTOM},
911 * {@link javax.swing.border.TitledBorder#BOTTOM},
912 * {@link javax.swing.border.TitledBorder#BELOW_BOTTOM},
913 * or {@link javax.swing.border.TitledBorder#DEFAULT_POSITION}.
915 * @param titleFont the font for the title text, or <code>null</code>
916 * to use a default from the current look and feel.
918 * @param titleColor the color for the title text, or <code>null</code>
919 * to use a default from the current look and feel.
921 * @throws IllegalArgumentException if <code>titleJustification</code>
922 * or <code>titlePosition</code> have an unsupported value.
924 public TitledBorderUIResource(Border border, String title,
925 int titleJustification, int titlePosition,
926 Font titleFont, Color titleColor)
928 super(border, title, titleJustification, titlePosition,
929 titleFont, titleColor);