Dead
[official-gcc.git] / gomp-20050608-branch / libjava / classpath / javax / swing / plaf / BorderUIResource.java
blob317cb09ac57b57a8bdafbf4ef75dec33a6b85fe1
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., 51 Franklin Street, Fifth Floor, Boston, MA
19 02110-1301 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 implements Border, UIResource, Serializable
76 /**
77 * Verified using the <code>serialver</code> tool
78 * of Apple/Sun JDK 1.3.1 on MacOS X 10.1.5.
80 static final long serialVersionUID = -3440553684010079691L;
83 /**
84 * A shared instance of an {@link EtchedBorderUIResource}, or
85 * <code>null</code> if the {@link #getEtchedBorderUIResource()}
86 * method has not yet been called.
88 private static Border etchedBorderUIResource;
91 /**
92 * A shared instance of a {@link BevelBorderUIResource} whose
93 * <code>bevelType</code> is {@link
94 * javax.swing.border.BevelBorder#LOWERED}, or <code>null</code> if
95 * the {@link #getLoweredBevelBorderUIResource()} has not yet been
96 * called.
98 private static Border loweredBevelBorderUIResource;
102 * A shared instance of a {@link BevelBorderUIResource} whose
103 * <code>bevelType</code> is {@link
104 * javax.swing.border.BevelBorder#RAISED}, or <code>null</code> if
105 * the {@link #getRaisedBevelBorderUIResource()} has not yet been
106 * called.
108 private static Border raisedBevelBorderUIResource;
112 * A shared instance of a {@link LineBorderUIResource} for
113 * a one-pixel thick black line, or <code>null</code> if
114 * the {@link #getBlackLineBorderUIResource()} has not yet been
115 * called.
117 private static Border blackLineBorderUIResource;
121 * Returns a shared instance of an etched border which also
122 * is marked as an {@link UIResource}.
124 * @see javax.swing.border.EtchedBorder
126 public static Border getEtchedBorderUIResource()
128 /* Swing is not designed to be thread-safe, so there is no
129 * need to synchronize the access to the global variable.
131 if (etchedBorderUIResource == null)
132 etchedBorderUIResource = new EtchedBorderUIResource();
133 return etchedBorderUIResource;
138 * Returns a shared instance of {@link BevelBorderUIResource} whose
139 * <code>bevelType</code> is {@link
140 * javax.swing.border.BevelBorder#LOWERED}.
142 * @see javax.swing.border.BevelBorder
144 public static Border getLoweredBevelBorderUIResource()
146 /* Swing is not designed to be thread-safe, so there is no
147 * need to synchronize the access to the global variable.
149 if (loweredBevelBorderUIResource == null)
150 loweredBevelBorderUIResource = new BevelBorderUIResource(
151 BevelBorder.LOWERED);
152 return loweredBevelBorderUIResource;
157 * Returns a shared instance of {@link BevelBorderUIResource} whose
158 * <code>bevelType</code> is {@link
159 * javax.swing.border.BevelBorder#RAISED}.
161 * @see javax.swing.border.BevelBorder
163 public static Border getRaisedBevelBorderUIResource()
165 /* Swing is not designed to be thread-safe, so there is no
166 * need to synchronize the access to the global variable.
168 if (raisedBevelBorderUIResource == null)
169 raisedBevelBorderUIResource = new BevelBorderUIResource(
170 BevelBorder.RAISED);
171 return raisedBevelBorderUIResource;
176 * Returns a shared instance of {@link LineBorderUIResource} for
177 * a black, one-pixel width border.
179 * @see javax.swing.border.LineBorder
181 public static Border getBlackLineBorderUIResource()
183 /* Swing is not designed to be thread-safe, so there is no
184 * need to synchronize the access to the global variable.
186 if (blackLineBorderUIResource == null)
187 blackLineBorderUIResource = new LineBorderUIResource(Color.black);
188 return blackLineBorderUIResource;
193 * The wrapped border.
195 private Border delegate;
199 * Constructs a <code>BorderUIResource</code> for wrapping
200 * a <code>Border</code> object.
202 * @param delegate the border to be wrapped.
204 public BorderUIResource(Border delegate)
206 if (delegate == null)
207 throw new IllegalArgumentException();
209 this.delegate = delegate;
214 * Paints the border around an enclosed component by calling
215 * the <code>paintBorder</code> method of the wrapped delegate.
217 * @param c the component whose border is to be painted.
218 * @param g the graphics for painting.
219 * @param x the horizontal position for painting the border.
220 * @param y the vertical position for painting the border.
221 * @param width the width of the available area for painting the border.
222 * @param height the height of the available area for painting the border.
224 public void paintBorder(Component c, Graphics g,
225 int x, int y, int width, int height)
227 delegate.paintBorder(c, g, x, y, width, height);
232 * Measures the width of this border by calling the
233 * <code>getBorderInsets</code> method of the wrapped
234 * delegate.
236 * @param c the component whose border is to be measured.
238 * @return an Insets object whose <code>left</code>, <code>right</code>,
239 * <code>top</code> and <code>bottom</code> fields indicate the
240 * width of the border at the respective edge.
242 public Insets getBorderInsets(Component c)
244 return delegate.getBorderInsets(c);
249 * Determines whether this border fills every pixel in its area
250 * when painting by calling the <code>isBorderOpaque</code>
251 * method of the wrapped delegate.
253 * @return <code>true</code> if the border is fully opaque, or
254 * <code>false</code> if some pixels of the background
255 * can shine through the border.
257 public boolean isBorderOpaque()
259 return delegate.isBorderOpaque();
264 * A {@link javax.swing.border.BevelBorder} that also implements the
265 * {@link UIResource} marker interface. This is useful for
266 * implementing pluggable look-and-feels: When switching the current
267 * LookAndFeel, only those borders are replaced that are marked as
268 * {@link UIResource}. For this reason, a look-and-feel should
269 * always install borders that implement <code>UIResource</code>,
270 * such as the borders provided by this class.
272 * @author Brian Jones (cbj@gnu.org)
273 * @author Sascha Brawer (brawer@dandelis.ch)
275 public static class BevelBorderUIResource
276 extends BevelBorder
277 implements UIResource, Serializable
279 private static final long serialVersionUID = -1275542891108351642L;
282 * Constructs a BevelBorderUIResource whose colors will be derived
283 * from the background of the enclosed component. The background
284 * color is retrieved each time the border is painted, so a border
285 * constructed by this method will automatically reflect a change
286 * to the component&#x2019;s background color.
288 * <p><img src="../border/doc-files/BevelBorder-1.png"
289 * width="500" height="150"
290 * alt="[An illustration showing raised and lowered BevelBorders]" /></p>
292 * @param bevelType the desired appearance of the border. The value
293 * must be either {@link javax.swing.border.BevelBorder#RAISED}
294 * or {@link javax.swing.border.BevelBorder#LOWERED}.
296 * @throws IllegalArgumentException if <code>bevelType</code> has
297 * an unsupported value.
299 public BevelBorderUIResource(int bevelType)
301 super(bevelType);
306 * Constructs a BevelBorderUIResource given its appearance type
307 * and two colors for its highlight and shadow.
309 * <p><img src="../border/doc-files/BevelBorder-2.png" width="500"
310 * height="150" alt="[An illustration showing BevelBorders that were
311 * constructed with this method]" /></p>
313 * @param bevelType the desired appearance of the border. The value
314 * must be either {@link javax.swing.border.BevelBorder#RAISED}
315 * or {@link javax.swing.border.BevelBorder#LOWERED}.
317 * @param highlight the color that will be used for the inner side
318 * of the highlighted edges (top and left if if
319 * <code>bevelType</code> is {@link
320 * javax.swing.border.BevelBorder#RAISED}; bottom and right
321 * otherwise). The color for the outer side is a brightened
322 * version of this color.
324 * @param shadow the color that will be used for the outer side of
325 * the shadowed edges (bottom and right if
326 * <code>bevelType</code> is {@link
327 * javax.swing.border.BevelBorder#RAISED}; top and left
328 * otherwise). The color for the inner side is a brightened
329 * version of this color.
331 * @throws IllegalArgumentException if <code>bevelType</code> has
332 * an unsupported value.
334 * @throws NullPointerException if <code>highlight</code> or
335 * <code>shadow</code> is <code>null</code>.
337 public BevelBorderUIResource(int bevelType,
338 Color highlight,
339 Color shadow)
341 super(bevelType, highlight, shadow);
346 * Constructs a BevelBorderUIResource given its appearance type
347 * and all its colors.
349 * <p><img src="../border/doc-files/BevelBorder-3.png" width="500"
350 * height="150" alt="[An illustration showing BevelBorders that
351 * were constructed with this method]" /></p>
353 * @param bevelType the desired appearance of the border. The value
354 * must be either {@link javax.swing.border.BevelBorder#RAISED}
355 * or {@link javax.swing.border.BevelBorder#LOWERED}.
357 * @param highlightOuter the color that will be used for the outer
358 * side of the highlighted edges (top and left if
359 * <code>bevelType</code> is {@link
360 * javax.swing.border.BevelBorder#RAISED}; bottom and right
361 * otherwise).
363 * @param highlightInner the color that will be used for the inner
364 * side of the highlighted edges.
366 * @param shadowOuter the color that will be used for the outer
367 * side of the shadowed edges (bottom and right if
368 * <code>bevelType</code> is {@link
369 * javax.swing.border.BevelBorder#RAISED}; top and left
370 * otherwise).
372 * @param shadowInner the color that will be used for the inner
373 * side of the shadowed edges.
375 * @throws IllegalArgumentException if <code>bevelType</code> has
376 * an unsupported value.
378 * @throws NullPointerException if one of the passed colors
379 * is <code>null</code>.
381 public BevelBorderUIResource(int bevelType,
382 Color highlightOuter,
383 Color highlightInner,
384 Color shadowOuter,
385 Color shadowInner)
387 super(bevelType,
388 highlightOuter, highlightInner,
389 shadowOuter, shadowInner);
395 * A {@link javax.swing.border.CompoundBorder} that also implements the
396 * {@link UIResource} marker interface. This is useful for
397 * implementing pluggable look-and-feels: When switching the current
398 * LookAndFeel, only those borders are replaced that are marked as
399 * {@link UIResource}. For this reason, a look-and-feel should
400 * always install borders that implement <code>UIResource</code>,
401 * such as the borders provided by this class.
403 * @author Brian Jones (cbj@gnu.org)
404 * @author Sascha Brawer (brawer@dandelis.ch)
406 public static class CompoundBorderUIResource
407 extends CompoundBorder
408 implements UIResource, Serializable
410 private static final long serialVersionUID = 7550017084975167341L;
413 * Constructs a CompoundBorderUIResource with the specified inside
414 * and outside borders.
416 * @param outsideBorder the outside border, which is painted to the
417 * outside of both <code>insideBorder</code> and the enclosed
418 * component. It is acceptable to pass <code>null</code>, in
419 * which case no outside border is painted.
421 * @param insideBorder the inside border, which is painted to
422 * between <code>outsideBorder</code> and the enclosed
423 * component. It is acceptable to pass <code>null</code>, in
424 * which case no inside border is painted.
426 public CompoundBorderUIResource(Border outsideBorder,
427 Border insideBorder)
429 super(outsideBorder, insideBorder);
435 * An {@link javax.swing.border.EmptyBorder} that also implements the
436 * {@link UIResource} marker interface. This is useful for
437 * implementing pluggable look-and-feels: When switching the current
438 * LookAndFeel, only those borders are replaced that are marked as
439 * {@link UIResource}. For this reason, a look-and-feel should
440 * always install borders that implement <code>UIResource</code>,
441 * such as the borders provided by this class.
443 * <p><img src="../border/doc-files/EmptyBorder-1.png"
444 * width="290" height="200"
445 * alt="[An illustration of EmptyBorder]" /></p>
447 * @author Brian Jones (cbj@gnu.org)
448 * @author Sascha Brawer (brawer@dandelis.ch)
450 public static class EmptyBorderUIResource
451 extends EmptyBorder
452 implements UIResource, Serializable
454 private static final long serialVersionUID = -4914187529340071708L;
457 * Constructs an empty border given the number of pixels required
458 * on each side.
460 * @param top the number of pixels that the border will need
461 * for its top edge.
463 * @param left the number of pixels that the border will need
464 * for its left edge.
466 * @param bottom the number of pixels that the border will need
467 * for its bottom edge.
469 * @param right the number of pixels that the border will need
470 * for its right edge.
472 public EmptyBorderUIResource(int top, int left, int bottom, int right)
474 super(top, left, bottom, right);
479 * Constructs an empty border given the number of pixels required
480 * on each side, passed in an Insets object.
482 * @param insets the Insets for the new border.
484 public EmptyBorderUIResource(Insets insets)
486 super(insets);
492 * An {@link javax.swing.border.EtchedBorder} that also implements the
493 * {@link UIResource} marker interface. This is useful for
494 * implementing pluggable look-and-feels: When switching the current
495 * LookAndFeel, only those borders are replaced that are marked as
496 * {@link UIResource}. For this reason, a look-and-feel should
497 * always install borders that implement <code>UIResource</code>,
498 * such as the borders provided by this class.
500 * <p><img src="../border/doc-files/EtchedBorder-1.png" width="500"
501 * height="200" alt="[An illustration of the two EtchedBorder
502 * variants]" /></p>
504 * @author Brian Jones (cbj@gnu.org)
505 * @author Sascha Brawer (brawer@dandelis.ch)
507 public static class EtchedBorderUIResource
508 extends EtchedBorder
509 implements UIResource, Serializable
511 private static final long serialVersionUID = -8186391754165296656L;
514 * Constructs an EtchedBorderUIResource that appears lowered into
515 * the surface. The colors will be derived from the background
516 * color of the enclosed Component when the border gets painted.
518 public EtchedBorderUIResource()
520 super();
525 * Constructs an EtchedBorderUIResource with the specified
526 * appearance. The colors will be derived from the background
527 * color of the enclosed Component when the border gets painted.
529 * <p><img src="../border/doc-files/EtchedBorder-1.png"
530 * width="500" height="200" alt="[An illustration of the two
531 * EtchedBorder variants]" /></p>
533 * @param etchType the desired appearance of the border. The value
534 * must be either {@link javax.swing.border.EtchedBorder#RAISED}
535 * or {@link javax.swing.border.EtchedBorder#LOWERED}.
537 * @throws IllegalArgumentException if <code>etchType</code> has
538 * an unsupported value.
540 public EtchedBorderUIResource(int etchType)
542 super(etchType);
547 * Constructs a lowered EtchedBorderUIResource, explicitly
548 * selecting the colors that will be used for highlight and
549 * shadow.
551 * @param highlight the color that will be used for painting
552 * the highlight part of the border.
554 * @param shadow the color that will be used for painting
555 * the shadow part of the border.
557 * @see EtchedBorderUIResource#EtchedBorderUIResource(int, Color, Color)
559 public EtchedBorderUIResource(Color highlight, Color shadow)
561 super(highlight, shadow);
566 * Constructs an EtchedBorderUIResource with the specified
567 * appearance, explicitly selecting the colors that will be used
568 * for highlight and shadow.
570 * <p><img src="../border/doc-files/EtchedBorder-2.png" width="500"
571 * height="200" alt="[An illustration that shows which pixels get
572 * painted in what color]" /></p>
574 * @param etchType the desired appearance of the border. The value
575 * must be either {@link javax.swing.border.EtchedBorder#RAISED}
576 * or {@link javax.swing.border.EtchedBorder#LOWERED}.
578 * @param highlight the color that will be used for painting
579 * the highlight part of the border.
581 * @param shadow the color that will be used for painting
582 * the shadow part of the border.
584 * @throws IllegalArgumentException if <code>etchType</code> has
585 * an unsupported value.
587 public EtchedBorderUIResource(int etchType,
588 Color highlight, Color shadow)
590 super(etchType, highlight, shadow);
596 * A {@link javax.swing.border.LineBorder} that also implements the
597 * {@link UIResource} marker interface. This is useful for
598 * implementing pluggable look-and-feels: When switching the current
599 * LookAndFeel, only those borders are replaced that are marked as
600 * {@link UIResource}. For this reason, a look-and-feel should
601 * always install borders that implement <code>UIResource</code>,
602 * such as the borders provided by this class.
604 * <p><img src="../border/doc-files/LineBorder-1.png" width="500"
605 * height="200" alt="[An illustration of two LineBorders]" /></p>
607 * @author Brian Jones (cbj@gnu.org)
608 * @author Sascha Brawer (brawer@dandelis.ch)
610 public static class LineBorderUIResource
611 extends LineBorder
612 implements UIResource, Serializable
614 private static final long serialVersionUID = -6171232338180172310L;
617 * Constructs a LineBorderUIResource given its color. The border
618 * will be one pixel thick and have plain corners.
620 * @param color the color for drawing the border.
622 public LineBorderUIResource(Color color)
624 super(color);
629 * Constructs a LineBorder given its color and thickness. The
630 * border will have plain corners.
632 * @param color the color for drawing the border.
633 * @param thickness the width of the line in pixels.
635 public LineBorderUIResource(Color color, int thickness)
637 super(color, thickness);
641 /* Note: Since JDK1.3, javax.swing.border.LineBorder also has a
642 * constructor which accepts a value for the roundedCorners
643 * property. However, as of JDK1.4.1, the LineBorderUIResource
644 * subclass does not have a corresponding constructor.
646 * A request for enhancing the Swing API has been filed with Sun:
647 * http://developer.java.sun.com/developer/bugParade/bugs/4879999.html
653 * A {@link javax.swing.border.MatteBorder} that also implements the
654 * {@link UIResource} marker interface. This is useful for
655 * implementing pluggable look-and-feels: When switching the current
656 * LookAndFeel, only those borders are replaced that are marked as
657 * {@link UIResource}. For this reason, a look-and-feel should
658 * always install borders that implement <code>UIResource</code>,
659 * such as the borders provided by this class.
661 * <p><img src="../border/doc-files/MatteBorder-1.png" width="500"
662 * height="150" alt="[An illustration of two MatteBorders]" /></p>
664 * @author Brian Jones (cbj@gnu.org)
665 * @author Sascha Brawer (brawer@dandelis.ch)
667 public static class MatteBorderUIResource
668 extends MatteBorder
669 implements UIResource, Serializable
671 private static final long serialVersionUID = -8107923147541851122L;
674 * Constructs a MatteBorderUIResource given the width on each side
675 * and a fill color.
677 * <p><img src="../border/doc-files/MatteBorder-2.png" width="500"
678 * height="150" alt="[A picture of a MatteBorder made by this
679 * constructor]" /></p>
681 * @param top the width of the border at its top edge.
682 * @param left the width of the border at its left edge.
683 * @param bottom the width of the border at its bottom edge.
684 * @param right the width of the border at its right edge.
685 * @param color the color for filling the border.
687 public MatteBorderUIResource(int top, int left,
688 int bottom, int right,
689 Color color)
691 super(top, left, bottom, right, color);
696 * Constructs a MatteBorderUIResource given the width on each side
697 * and an icon for tiling the border area.
699 * <p><img src="../border/doc-files/MatteBorder-4.png" width="500"
700 * height="150" alt="[A picture of a MatteBorder made by this
701 * constructor]" /></p>
703 * @param top the width of the border at its top edge.
704 * @param left the width of the border at its left edge.
705 * @param bottom the width of the border at its bottom edge.
706 * @param right the width of the border at its right edge.
707 * @param tileIcon an icon for tiling the border area.
709 public MatteBorderUIResource(int top, int left,
710 int bottom, int right,
711 Icon tileIcon)
713 super(top, left, bottom, right, tileIcon);
718 * Constructs a MatteBorderUIResource given an icon for tiling the
719 * border area. The icon width is used for the border insets at
720 * the left and right edge, the icon height for the top and bottom
721 * edge.
723 * <p><img src="../border/doc-files/MatteBorder-6.png" width="500"
724 * height="150" alt="[A picture of a MatteBorder made by this
725 * constructor]" /></p>
727 * @param tileIcon an icon for tiling the border area.
729 public MatteBorderUIResource(Icon tileIcon)
731 super(tileIcon);
737 * A {@link javax.swing.border.TitledBorder} that also implements the
738 * {@link UIResource} marker interface. This is useful for
739 * implementing pluggable look-and-feels: When switching the current
740 * LookAndFeel, only those borders are replaced that are marked as
741 * {@link UIResource}. For this reason, a look-and-feel should
742 * always install borders that implement <code>UIResource</code>,
743 * such as the borders provided by this class.
745 * @author Brian Jones (cbj@gnu.org)
746 * @author Sascha Brawer (brawer@dandelis.ch)
748 public static class TitledBorderUIResource
749 extends TitledBorder
750 implements UIResource, Serializable
752 private static final long serialVersionUID = 7667113547406407427L;
755 * Constructs a TitledBorderUIResource given the text of its title.
757 * @param title the title text, or <code>null</code> to use no
758 * title text.
760 public TitledBorderUIResource(String title)
762 super(title);
767 * Constructs an initially untitled TitledBorderUIResource
768 * given another border.
770 * @param border the border underneath the title, or
771 * <code>null</code> to use a default from
772 * the current look and feel.
774 public TitledBorderUIResource(Border border)
776 super(border);
781 * Constructs a TitledBorder given its border and title text.
783 * @param border the border underneath the title, or
784 * <code>null</code> to use a default from
785 * the current look and feel.
787 * @param title the title text, or <code>null</code>
788 * to use no title text.
790 public TitledBorderUIResource(Border border, String title)
792 super(border, title);
797 * Constructs a TitledBorderUIResource given its border, title
798 * text, horizontal alignment, and vertical position.
800 * @param border the border underneath the title, or
801 * <code>null</code> to use a default
802 * from the current look and feel.
804 * @param title the title text, or <code>null</code>
805 * to use no title text.
807 * @param titleJustification the horizontal alignment of the title
808 * text in relation to the border. The value must be one of
809 * {@link javax.swing.border.TitledBorder#LEFT},
810 * {@link javax.swing.border.TitledBorder#CENTER},
811 * {@link javax.swing.border.TitledBorder#RIGHT},
812 * {@link javax.swing.border.TitledBorder#LEADING},
813 * {@link javax.swing.border.TitledBorder#TRAILING}, or
814 * {@link javax.swing.border.TitledBorder#DEFAULT_JUSTIFICATION}.
816 * @param titlePosition the vertical position of the title text
817 * in relation to the border. The value must be one of
818 * {@link javax.swing.border.TitledBorder#ABOVE_TOP},
819 * {@link javax.swing.border.TitledBorder#TOP},
820 * {@link javax.swing.border.TitledBorder#BELOW_TOP},
821 * {@link javax.swing.border.TitledBorder#ABOVE_BOTTOM},
822 * {@link javax.swing.border.TitledBorder#BOTTOM},
823 * {@link javax.swing.border.TitledBorder#BELOW_BOTTOM},
824 * or {@link javax.swing.border.TitledBorder#DEFAULT_POSITION}.
826 * @throws IllegalArgumentException if <code>titleJustification</code>
827 * or <code>titlePosition</code> have an unsupported value.
829 public TitledBorderUIResource(Border border, String title,
830 int titleJustification,
831 int titlePosition)
833 super(border, title, titleJustification, titlePosition);
838 * Constructs a TitledBorder given its border, title text,
839 * horizontal alignment, vertical position, and font.
841 * @param border the border underneath the title, or
842 * <code>null</code> to use a default
843 * from the current look and feel.
845 * @param title the title text, or <code>null</code>
846 * to use no title text.
848 * @param titleJustification the horizontal alignment of the title
849 * text in relation to the border. The value must be one of
850 * {@link javax.swing.border.TitledBorder#LEFT},
851 * {@link javax.swing.border.TitledBorder#CENTER},
852 * {@link javax.swing.border.TitledBorder#RIGHT},
853 * {@link javax.swing.border.TitledBorder#LEADING},
854 * {@link javax.swing.border.TitledBorder#TRAILING}, or
855 * {@link javax.swing.border.TitledBorder#DEFAULT_JUSTIFICATION}.
857 * @param titlePosition the vertical position of the title text
858 * in relation to the border. The value must be one of
859 * {@link javax.swing.border.TitledBorder#ABOVE_TOP},
860 * {@link javax.swing.border.TitledBorder#TOP},
861 * {@link javax.swing.border.TitledBorder#BELOW_TOP},
862 * {@link javax.swing.border.TitledBorder#ABOVE_BOTTOM},
863 * {@link javax.swing.border.TitledBorder#BOTTOM},
864 * {@link javax.swing.border.TitledBorder#BELOW_BOTTOM},
865 * or {@link javax.swing.border.TitledBorder#DEFAULT_POSITION}.
867 * @param titleFont the font for the title text, or <code>null</code>
868 * to use a default from the current look and feel.
870 * @throws IllegalArgumentException if <code>titleJustification</code>
871 * or <code>titlePosition</code> have an unsupported value.
873 public TitledBorderUIResource(Border border, String title,
874 int titleJustification,
875 int titlePosition,
876 Font titleFont)
878 super(border, title, titleJustification, titlePosition,
879 titleFont);
884 * Constructs a TitledBorder given its border, title text,
885 * horizontal alignment, vertical position, font, and color.
887 * @param border the border underneath the title, or
888 * <code>null</code> to use a default
889 * from the current look and feel.
891 * @param title the title text, or <code>null</code>
892 * to use no title text.
894 * @param titleJustification the horizontal alignment of the title
895 * text in relation to the border. The value must be one of
896 * {@link javax.swing.border.TitledBorder#LEFT},
897 * {@link javax.swing.border.TitledBorder#CENTER},
898 * {@link javax.swing.border.TitledBorder#RIGHT},
899 * {@link javax.swing.border.TitledBorder#LEADING},
900 * {@link javax.swing.border.TitledBorder#TRAILING}, or
901 * {@link javax.swing.border.TitledBorder#DEFAULT_JUSTIFICATION}.
903 * @param titlePosition the vertical position of the title text
904 * in relation to the border. The value must be one of
905 * {@link javax.swing.border.TitledBorder#ABOVE_TOP},
906 * {@link javax.swing.border.TitledBorder#TOP},
907 * {@link javax.swing.border.TitledBorder#BELOW_TOP},
908 * {@link javax.swing.border.TitledBorder#ABOVE_BOTTOM},
909 * {@link javax.swing.border.TitledBorder#BOTTOM},
910 * {@link javax.swing.border.TitledBorder#BELOW_BOTTOM},
911 * or {@link javax.swing.border.TitledBorder#DEFAULT_POSITION}.
913 * @param titleFont the font for the title text, or <code>null</code>
914 * to use a default from the current look and feel.
916 * @param titleColor the color for the title text, or <code>null</code>
917 * to use a default from the current look and feel.
919 * @throws IllegalArgumentException if <code>titleJustification</code>
920 * or <code>titlePosition</code> have an unsupported value.
922 public TitledBorderUIResource(Border border, String title,
923 int titleJustification, int titlePosition,
924 Font titleFont, Color titleColor)
926 super(border, title, titleJustification, titlePosition,
927 titleFont, titleColor);