2003-12-26 Guilhem Lavaux <guilhem@kaffe.org>
[official-gcc.git] / libjava / javax / swing / plaf / BorderUIResource.java
bloba3f0db026fd5f2faa9431d0581fb23878e4919ef
1 /* BorderUIResource.java
2 Copyright (C) 2002, 2003 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 javax.swing.border.*;
42 import javax.swing.Icon;
43 import java.io.Serializable;
44 import java.awt.Component;
45 import java.awt.Graphics;
46 import java.awt.Insets;
47 import java.awt.Font;
48 import java.awt.Color;
50 /**
51 * A wrapper for {@link javax.swing.border.Border} that also
52 * implements the {@link UIResource} marker interface. This is useful
53 * for implementing pluggable look-and-feels: When switching the
54 * current LookAndFeel, only those borders are replaced that are
55 * marked as {@link UIResource}. For this reason, a look-and-feel
56 * should always install borders that implement
57 * <code>UIResource</code>, such as the borders provided by this
58 * class.
60 * @serial
61 * @serialField delegate Border the <code>Border</code> wrapped
63 * @author Brian Jones (cbj@gnu.org)
64 * @author Sascha Brawer (brawer@dandelis.ch)
66 public class BorderUIResource
67 extends Object
68 implements Border, UIResource, Serializable
70 /**
71 * Verified using the <code>serialver</code> tool
72 * of Apple/Sun JDK 1.3.1 on MacOS X 10.1.5.
74 static final long serialVersionUID = -3440553684010079691L;
77 /**
78 * A shared instance of an {@link EtchedBorderUIResource}, or
79 * <code>null</code> if the {@link #getEtchedBorderUIResource()}
80 * method has not yet been called.
82 private static Border etchedBorderUIResource;
85 /**
86 * A shared instance of a {@link BevelBorderUIResource} whose
87 * <code>bevelType</code> is {@link
88 * javax.swing.border.BevelBorder#LOWERED}, or <code>null</code> if
89 * the {@link #getLoweredBevelBorderUIResource()} has not yet been
90 * called.
92 private static Border loweredBevelBorderUIResource;
95 /**
96 * A shared instance of a {@link BevelBorderUIResource} whose
97 * <code>bevelType</code> is {@link
98 * javax.swing.border.BevelBorder#RAISED}, or <code>null</code> if
99 * the {@link #getRaisedBevelBorderUIResource()} has not yet been
100 * called.
102 private static Border raisedBevelBorderUIResource;
106 * A shared instance of a {@link LineBorderUIResource} for
107 * a one-pixel thick black line, or <code>null</code> if
108 * the {@link #getBlackLineBorderUIResource()} has not yet been
109 * called.
111 private static Border blackLineBorderUIResource;
115 * Returns a shared instance of an etched border which also
116 * is marked as an {@link UIResource}.
118 * @see javax.swing.border.EtchedBorder
120 public static Border getEtchedBorderUIResource()
122 /* Swing is not designed to be thread-safe, so there is no
123 * need to synchronize the access to the global variable.
125 if (etchedBorderUIResource == null)
126 etchedBorderUIResource = new EtchedBorderUIResource();
127 return etchedBorderUIResource;
132 * Returns a shared instance of {@link BevelBorderUIResource} whose
133 * <code>bevelType</code> is {@link
134 * javax.swing.border.BevelBorder#LOWERED}.
136 * @see javax.swing.border.BevelBorder
138 public static Border getLoweredBevelBorderUIResource()
140 /* Swing is not designed to be thread-safe, so there is no
141 * need to synchronize the access to the global variable.
143 if (loweredBevelBorderUIResource == null)
144 loweredBevelBorderUIResource = new BevelBorderUIResource(
145 BevelBorder.LOWERED);
146 return loweredBevelBorderUIResource;
151 * Returns a shared instance of {@link BevelBorderUIResource} whose
152 * <code>bevelType</code> is {@link
153 * javax.swing.border.BevelBorder#RAISED}.
155 * @see javax.swing.border.BevelBorder
157 public static Border getRaisedBevelBorderUIResource()
159 /* Swing is not designed to be thread-safe, so there is no
160 * need to synchronize the access to the global variable.
162 if (raisedBevelBorderUIResource == null)
163 raisedBevelBorderUIResource = new BevelBorderUIResource(
164 BevelBorder.RAISED);
165 return raisedBevelBorderUIResource;
170 * Returns a shared instance of {@link LineBorderUIResource} for
171 * a black, one-pixel width border.
173 * @see javax.swing.border.LineBorder
175 public static Border getBlackLineBorderUIResource()
177 /* Swing is not designed to be thread-safe, so there is no
178 * need to synchronize the access to the global variable.
180 if (blackLineBorderUIResource == null)
181 blackLineBorderUIResource = new LineBorderUIResource(Color.black);
182 return blackLineBorderUIResource;
187 * The wrapped border.
189 private Border delegate;
193 * Constructs a <code>BorderUIResource</code> for wrapping
194 * a <code>Border</code> object.
196 * @param delegate the border to be wrapped.
198 public BorderUIResource(Border delegate)
200 if (delegate == null)
201 throw new IllegalArgumentException();
203 this.delegate = delegate;
208 * Paints the border around an enclosed component by calling
209 * the <code>paintBorder</code> method of the wrapped delegate.
211 * @param c the component whose border is to be painted.
212 * @param g the graphics for painting.
213 * @param x the horizontal position for painting the border.
214 * @param y the vertical position for painting the border.
215 * @param width the width of the available area for painting the border.
216 * @param height the height of the available area for painting the border.
218 public void paintBorder(Component c, Graphics g,
219 int x, int y, int width, int height)
221 delegate.paintBorder(c, g, x, y, width, height);
226 * Measures the width of this border by calling the
227 * <code>getBorderInsets</code> method of the wrapped
228 * delegate.
230 * @param c the component whose border is to be measured.
232 * @return an Insets object whose <code>left</code>, <code>right</code>,
233 * <code>top</code> and <code>bottom</code> fields indicate the
234 * width of the border at the respective edge.
236 public Insets getBorderInsets(Component c)
238 return delegate.getBorderInsets(c);
243 * Determines whether this border fills every pixel in its area
244 * when painting by calling the <code>isBorderOpaque</code>
245 * method of the wrapped delegate.
247 * @return <code>true</code> if the border is fully opaque, or
248 * <code>false</code> if some pixels of the background
249 * can shine through the border.
251 public boolean isBorderOpaque()
253 return delegate.isBorderOpaque();
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.
266 * @author Brian Jones (cbj@gnu.org)
267 * @author Sascha Brawer (brawer@dandelis.ch)
269 public static class BevelBorderUIResource
270 extends BevelBorder
271 implements UIResource, Serializable
274 * 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&#x2019;s background color.
280 * <p><img src="../border/doc-files/BevelBorder-1.png"
281 * width="500" height="150"
282 * alt="[An illustration showing raised and lowered BevelBorders]" />
284 * @param bevelType the desired appearance of the border. The value
285 * must be either {@link javax.swing.border.BevelBorder#RAISED}
286 * or {@link javax.swing.border.BevelBorder#LOWERED}.
288 * @throws IllegalArgumentException if <code>bevelType</code> has
289 * an unsupported value.
291 public BevelBorderUIResource(int bevelType)
293 super(bevelType);
298 * Constructs a BevelBorderUIResource given its appearance type
299 * and two colors for its highlight and shadow.
301 * <p><img src="../border/doc-files/BevelBorder-2.png" width="500"
302 * height="150" alt="[An illustration showing BevelBorders that were
303 * constructed with this method]" />
305 * @param bevelType the desired appearance of the border. The value
306 * must be either {@link javax.swing.border.BevelBorder#RAISED}
307 * or {@link javax.swing.border.BevelBorder#LOWERED}.
309 * @param highlight the color that will be used for the inner side
310 * of the highlighted edges (top and left if if
311 * <code>bevelType</code> is {@link
312 * javax.swing.border.BevelBorder#RAISED}; bottom and right
313 * otherwise). The color for the outer side is a brightened
314 * version of this color.
316 * @param shadow the color that will be used for the outer side of
317 * the shadowed edges (bottom and right if
318 * <code>bevelType</code> is {@link
319 * javax.swing.border.BevelBorder#RAISED}; top and left
320 * otherwise). The color for the inner side is a brightened
321 * version of this color.
323 * @throws IllegalArgumentException if <code>bevelType</code> has
324 * an unsupported value.
326 * @throws NullPointerException if <code>highlight</code> or
327 * <code>shadow</code> is <code>null</code>.
329 public BevelBorderUIResource(int bevelType,
330 Color highlight,
331 Color shadow)
333 super(bevelType, highlight, shadow);
338 * Constructs a BevelBorderUIResource given its appearance type
339 * and all its colors.
341 * <p><img src="../border/doc-files/BevelBorder-3.png" width="500"
342 * height="150" alt="[An illustration showing BevelBorders that
343 * were constructed with this method]" />
345 * @param bevelType the desired appearance of the border. The value
346 * must be either {@link javax.swing.border.BevelBorder#RAISED}
347 * or {@link javax.swing.border.BevelBorder#LOWERED}.
349 * @param highlightOuter the color that will be used for the outer
350 * side of the highlighted edges (top and left if
351 * <code>bevelType</code> is {@link
352 * javax.swing.border.BevelBorder#RAISED}; bottom and right
353 * otherwise).
355 * @param highlightInner the color that will be used for the inner
356 * side of the highlighted edges.
358 * @param shadowOuter the color that will be used for the outer
359 * side of the shadowed edges (bottom and right if
360 * <code>bevelType</code> is {@link
361 * javax.swing.border.BevelBorder#RAISED}; top and left
362 * otherwise).
364 * @param shadowInner the color that will be used for the inner
365 * side of the shadowed edges.
367 * @throws IllegalArgumentException if <code>bevelType</code> has
368 * an unsupported value.
370 * @throws NullPointerException if one of the passed colors
371 * is <code>null</code>.
373 public BevelBorderUIResource(int bevelType,
374 Color highlightOuter,
375 Color highlightInner,
376 Color shadowOuter,
377 Color shadowInner)
379 super(bevelType,
380 highlightOuter, highlightInner,
381 shadowOuter, shadowInner);
387 * A {@link javax.swing.border.CompoundBorder} that also implements the
388 * {@link UIResource} marker interface. This is useful for
389 * implementing pluggable look-and-feels: When switching the current
390 * LookAndFeel, only those borders are replaced that are marked as
391 * {@link UIResource}. For this reason, a look-and-feel should
392 * always install borders that implement <code>UIResource</code>,
393 * such as the borders provided by this class.
395 * @author Brian Jones (cbj@gnu.org)
396 * @author Sascha Brawer (brawer@dandelis.ch)
398 public static class CompoundBorderUIResource
399 extends CompoundBorder
400 implements UIResource, Serializable
403 * Constructs a CompoundBorderUIResource with the specified inside
404 * and outside borders.
406 * @param outsideBorder the outside border, which is painted to the
407 * outside of both <code>insideBorder</code> and the enclosed
408 * component. It is acceptable to pass <code>null</code>, in
409 * which case no outside border is painted.
411 * @param insideBorder the inside border, which is painted to
412 * between <code>outsideBorder</code> and the enclosed
413 * component. It is acceptable to pass <code>null</code>, in
414 * which case no inside border is painted.
416 public CompoundBorderUIResource(Border outsideBorder,
417 Border insideBorder)
419 super(outsideBorder, insideBorder);
425 * An {@link javax.swing.border.EmptyBorder} that also implements the
426 * {@link UIResource} marker interface. This is useful for
427 * implementing pluggable look-and-feels: When switching the current
428 * LookAndFeel, only those borders are replaced that are marked as
429 * {@link UIResource}. For this reason, a look-and-feel should
430 * always install borders that implement <code>UIResource</code>,
431 * such as the borders provided by this class.
433 * <p><img src="../border/doc-files/EmptyBorder-1.png"
434 * width="290" height="200"
435 * alt="[An illustration of EmptyBorder]" />
437 * @author Brian Jones (cbj@gnu.org)
438 * @author Sascha Brawer (brawer@dandelis.ch)
440 public static class EmptyBorderUIResource
441 extends EmptyBorder
442 implements UIResource, Serializable
445 * Constructs an empty border given the number of pixels required
446 * on each side.
448 * @param top the number of pixels that the border will need
449 * for its top edge.
451 * @param left the number of pixels that the border will need
452 * for its left edge.
454 * @param bottom the number of pixels that the border will need
455 * for its bottom edge.
457 * @param right the number of pixels that the border will need
458 * for its right edge.
460 public EmptyBorderUIResource(int top, int left, int bottom, int right)
462 super(top, left, bottom, right);
467 * Constructs an empty border given the number of pixels required
468 * on each side, passed in an Insets object.
470 * @param insets the Insets for the new border.
472 public EmptyBorderUIResource(Insets insets)
474 super(insets);
480 * An {@link javax.swing.border.EtchedBorder} that also implements the
481 * {@link UIResource} marker interface. This is useful for
482 * implementing pluggable look-and-feels: When switching the current
483 * LookAndFeel, only those borders are replaced that are marked as
484 * {@link UIResource}. For this reason, a look-and-feel should
485 * always install borders that implement <code>UIResource</code>,
486 * such as the borders provided by this class.
488 * <p><img src="../border/doc-files/EtchedBorder-1.png" width="500"
489 * height="200" alt="[An illustration of the two EtchedBorder
490 * variants]" />
492 * @author Brian Jones (cbj@gnu.org)
493 * @author Sascha Brawer (brawer@dandelis.ch)
495 public static class EtchedBorderUIResource
496 extends EtchedBorder
497 implements UIResource, Serializable
500 * Constructs an EtchedBorderUIResource that appears lowered into
501 * the surface. The colors will be derived from the background
502 * color of the enclosed Component when the border gets painted.
504 public EtchedBorderUIResource()
506 super();
511 * Constructs an EtchedBorderUIResource with the specified
512 * appearance. The colors will be derived from the background
513 * color of the enclosed Component when the border gets painted.
515 * <p><img src="../border/doc-files/EtchedBorder-1.png"
516 * width="500" height="200" alt="[An illustration of the two
517 * EtchedBorder variants]" />
519 * @param etchType the desired appearance of the border. The value
520 * must be either {@link javax.swing.border.EtchedBorder#RAISED}
521 * or {@link javax.swing.border.EtchedBorder#LOWERED}.
523 * @throws IllegalArgumentException if <code>etchType</code> has
524 * an unsupported value.
526 public EtchedBorderUIResource(int etchType)
528 super(etchType);
533 * Constructs a lowered EtchedBorderUIResource, explicitly
534 * selecting the colors that will be used for highlight and
535 * shadow.
537 * @param highlight the color that will be used for painting
538 * the highlight part of the border.
540 * @param shadow the color that will be used for painting
541 * the shadow part of the border.
543 * @see #EtchedBorderUIResource(int, Color, Color)
545 public EtchedBorderUIResource(Color highlight, Color shadow)
547 super(highlight, shadow);
552 * Constructs an EtchedBorderUIResource with the specified
553 * appearance, explicitly selecting the colors that will be used
554 * for highlight and shadow.
556 * <p><img src="../border/doc-files/EtchedBorder-2.png" width="500"
557 * height="200" alt="[An illustration that shows which pixels get
558 * painted in what color]" />
560 * @param etchType the desired appearance of the border. The value
561 * must be either {@link javax.swing.border.EtchedBorder#RAISED}
562 * or {@link javax.swing.border.EtchedBorder#LOWERED}.
564 * @param highlight the color that will be used for painting
565 * the highlight part of the border.
567 * @param shadow the color that will be used for painting
568 * the shadow part of the border.
570 * @throws IllegalArgumentException if <code>etchType</code> has
571 * an unsupported value.
573 public EtchedBorderUIResource(int etchType,
574 Color highlight, Color shadow)
576 super(etchType, highlight, shadow);
582 * A {@link javax.swing.border.LineBorder} that also implements the
583 * {@link UIResource} marker interface. This is useful for
584 * implementing pluggable look-and-feels: When switching the current
585 * LookAndFeel, only those borders are replaced that are marked as
586 * {@link UIResource}. For this reason, a look-and-feel should
587 * always install borders that implement <code>UIResource</code>,
588 * such as the borders provided by this class.
590 * <p><img src="../border/doc-files/LineBorder-1.png" width="500"
591 * height="200" alt="[An illustration of two LineBorders] />
593 * @author Brian Jones (cbj@gnu.org)
594 * @author Sascha Brawer (brawer@dandelis.ch)
596 public static class LineBorderUIResource
597 extends LineBorder
598 implements UIResource, Serializable
601 * Constructs a LineBorderUIResource given its color. The border
602 * will be one pixel thick and have plain corners.
604 * @param color the color for drawing the border.
606 public LineBorderUIResource(Color color)
608 super(color);
613 * Constructs a LineBorder given its color and thickness. The
614 * border will have plain corners.
616 * @param color the color for drawing the border.
617 * @param thickness the width of the line in pixels.
619 public LineBorderUIResource(Color color, int thickness)
621 super(color, thickness);
625 /* Note: Since JDK1.3, javax.swing.border.LineBorder also has a
626 * constructor which accepts a value for the roundedCorners
627 * property. However, as of JDK1.4.1, the LineBorderUIResource
628 * subclass does not have a corresponding constructor.
630 * A request for enhancing the Swing API has been filed with Sun:
631 * http://developer.java.sun.com/developer/bugParade/bugs/4879999.html
637 * A {@link javax.swing.border.MatteBorder} that also implements the
638 * {@link UIResource} marker interface. This is useful for
639 * implementing pluggable look-and-feels: When switching the current
640 * LookAndFeel, only those borders are replaced that are marked as
641 * {@link UIResource}. For this reason, a look-and-feel should
642 * always install borders that implement <code>UIResource</code>,
643 * such as the borders provided by this class.
645 * <p><img src="../border/doc-files/MatteBorder-1.png" width="500"
646 * height="150" alt="[An illustration of two MatteBorders] />
648 * @author Brian Jones (cbj@gnu.org)
649 * @author Sascha Brawer (brawer@dandelis.ch)
651 public static class MatteBorderUIResource
652 extends MatteBorder
653 implements UIResource, Serializable
656 * Constructs a MatteBorderUIResource given the width on each side
657 * and a fill color.
659 * <p><img src="../border/doc-files/MatteBorder-2.png" width="500"
660 * height="150" alt="[A picture of a MatteBorder made by this
661 * constructor]" />
663 * @param top the width of the border at its top edge.
664 * @param left the width of the border at its left edge.
665 * @param bottom the width of the border at its bottom edge.
666 * @param right the width of the border at its right edge.
667 * @param matteColor the color for filling the border.
669 public MatteBorderUIResource(int top, int left,
670 int bottom, int right,
671 Color color)
673 super(top, left, bottom, right, color);
678 * Constructs a MatteBorderUIResource given the width on each side
679 * and an icon for tiling the border area.
681 * <p><img src="../border/doc-files/MatteBorder-4.png" width="500"
682 * height="150" alt="[A picture of a MatteBorder made by this
683 * constructor]" />
685 * @param top the width of the border at its top edge.
686 * @param left the width of the border at its left edge.
687 * @param bottom the width of the border at its bottom edge.
688 * @param right the width of the border at its right edge.
689 * @param tileIcon an icon for tiling the border area.
691 public MatteBorderUIResource(int top, int left,
692 int bottom, int right,
693 Icon tileIcon)
695 super(top, left, bottom, right, tileIcon);
700 * Constructs a MatteBorderUIResource given an icon for tiling the
701 * border area. The icon width is used for the border insets at
702 * the left and right edge, the icon height for the top and bottom
703 * edge.
705 * <p><img src="../border/doc-files/MatteBorder-6.png" width="500"
706 * height="150" alt="[A picture of a MatteBorder made by this
707 * constructor]" />
709 * @param tileIcon an icon for tiling the border area.
711 public MatteBorderUIResource(Icon tileIcon)
713 super(tileIcon);
719 * A {@link javax.swing.border.TitledBorder} that also implements the
720 * {@link UIResource} marker interface. This is useful for
721 * implementing pluggable look-and-feels: When switching the current
722 * LookAndFeel, only those borders are replaced that are marked as
723 * {@link UIResource}. For this reason, a look-and-feel should
724 * always install borders that implement <code>UIResource</code>,
725 * such as the borders provided by this class.
727 * @author Brian Jones (cbj@gnu.org)
728 * @author Sascha Brawer (brawer@dandelis.ch)
730 public static class TitledBorderUIResource
731 extends TitledBorder
732 implements UIResource, Serializable
735 * Constructs a TitledBorderUIResource given the text of its title.
737 * @param title the title text, or <code>null</code> to use no
738 * title text.
740 public TitledBorderUIResource(String title)
742 super(title);
747 * Constructs an initially untitled TitledBorderUIResource
748 * given another border.
750 * @param border the border underneath the title, or
751 * <code>null</code> to use a default from
752 * the current look and feel.
754 public TitledBorderUIResource(Border border)
756 super(border);
761 * Constructs a TitledBorder given its border and title text.
763 * @param border the border underneath the title, or
764 * <code>null</code> to use a default from
765 * the current look and feel.
767 * @param title the title text, or <code>null</code>
768 * to use no title text.
770 public TitledBorderUIResource(Border border, String title)
772 super(border, title);
777 * Constructs a TitledBorderUIResource given its border, title
778 * text, horizontal alignment, and vertical position.
780 * @param border the border underneath the title, or
781 * <code>null</code> to use a default
782 * from the current look and feel.
784 * @param title the title text, or <code>null</code>
785 * to use no title text.
787 * @param titleJustification the horizontal alignment of the title
788 * text in relation to the border. The value must be one of
789 * {@link javax.swing.border.TitledBorder#LEFT},
790 * {@link javax.swing.border.TitledBorder#CENTER},
791 * {@link javax.swing.border.TitledBorder#RIGHT},
792 * {@link javax.swing.border.TitledBorder#LEADING},
793 * {@link javax.swing.border.TitledBorder#TRAILING}, or
794 * {@link javax.swing.border.TitledBorder#DEFAULT_JUSTIFICATION}.
796 * @param titlePosition the vertical position of the title text
797 * in relation to the border. The value must be one of
798 * {@link javax.swing.border.TitledBorder#ABOVE_TOP},
799 * {@link javax.swing.border.TitledBorder#TOP},
800 * {@link javax.swing.border.TitledBorder#BELOW_TOP},
801 * {@link javax.swing.border.TitledBorder#ABOVE_BOTTOM},
802 * {@link javax.swing.border.TitledBorder#BOTTOM},
803 * {@link javax.swing.border.TitledBorder#BELOW_BOTTOM},
804 * or {@link javax.swing.border.TitledBorder#DEFAULT_POSITION}.
806 * @throws IllegalArgumentException if <code>titleJustification</code>
807 * or <code>titlePosition</code> have an unsupported value.
809 public TitledBorderUIResource(Border border, String title,
810 int titleJustification,
811 int titlePosition)
813 super(border, title, titleJustification, titlePosition);
818 * Constructs a TitledBorder given its border, title text,
819 * horizontal alignment, vertical position, and font.
821 * @param border the border underneath the title, or
822 * <code>null</code> to use a default
823 * from the current look and feel.
825 * @param title the title text, or <code>null</code>
826 * to use no title text.
828 * @param titleJustification the horizontal alignment of the title
829 * text in relation to the border. The value must be one of
830 * {@link javax.swing.border.TitledBorder#LEFT},
831 * {@link javax.swing.border.TitledBorder#CENTER},
832 * {@link javax.swing.border.TitledBorder#RIGHT},
833 * {@link javax.swing.border.TitledBorder#LEADING},
834 * {@link javax.swing.border.TitledBorder#TRAILING}, or
835 * {@link javax.swing.border.TitledBorder#DEFAULT_JUSTIFICATION}.
837 * @param titlePosition the vertical position of the title text
838 * in relation to the border. The value must be one of
839 * {@link javax.swing.border.TitledBorder#ABOVE_TOP},
840 * {@link javax.swing.border.TitledBorder#TOP},
841 * {@link javax.swing.border.TitledBorder#BELOW_TOP},
842 * {@link javax.swing.border.TitledBorder#ABOVE_BOTTOM},
843 * {@link javax.swing.border.TitledBorder#BOTTOM},
844 * {@link javax.swing.border.TitledBorder#BELOW_BOTTOM},
845 * or {@link javax.swing.border.TitledBorder#DEFAULT_POSITION}.
847 * @param titleFont the font for the title text, or <code>null</code>
848 * to use a default from the current look and feel.
850 * @throws IllegalArgumentException if <code>titleJustification</code>
851 * or <code>titlePosition</code> have an unsupported value.
853 public TitledBorderUIResource(Border border, String title,
854 int titleJustification,
855 int titlePosition,
856 Font titleFont)
858 super(border, title, titleJustification, titlePosition,
859 titleFont);
864 * Constructs a TitledBorder given its border, title text,
865 * horizontal alignment, vertical position, font, and color.
867 * @param border the border underneath the title, or
868 * <code>null</code> to use a default
869 * from the current look and feel.
871 * @param title the title text, or <code>null</code>
872 * to use no title text.
874 * @param titleJustification the horizontal alignment of the title
875 * text in relation to the border. The value must be one of
876 * {@link javax.swing.border.TitledBorder#LEFT},
877 * {@link javax.swing.border.TitledBorder#CENTER},
878 * {@link javax.swing.border.TitledBorder#RIGHT},
879 * {@link javax.swing.border.TitledBorder#LEADING},
880 * {@link javax.swing.border.TitledBorder#TRAILING}, or
881 * {@link javax.swing.border.TitledBorder#DEFAULT_JUSTIFICATION}.
883 * @param titlePosition the vertical position of the title text
884 * in relation to the border. The value must be one of
885 * {@link javax.swing.border.TitledBorder#ABOVE_TOP},
886 * {@link javax.swing.border.TitledBorder#TOP},
887 * {@link javax.swing.border.TitledBorder#BELOW_TOP},
888 * {@link javax.swing.border.TitledBorder#ABOVE_BOTTOM},
889 * {@link javax.swing.border.TitledBorder#BOTTOM},
890 * {@link javax.swing.border.TitledBorder#BELOW_BOTTOM},
891 * or {@link javax.swing.border.TitledBorder#DEFAULT_POSITION}.
893 * @param titleFont the font for the title text, or <code>null</code>
894 * to use a default from the current look and feel.
896 * @param titleColor the color for the title text, or <code>null</code>
897 * to use a default from the current look and feel.
899 * @throws IllegalArgumentException if <code>titleJustification</code>
900 * or <code>titlePosition</code> have an unsupported value.
902 public TitledBorderUIResource(Border border, String title,
903 int titleJustification, int titlePosition,
904 Font titleFont, Color titleColor)
906 super(border, title, titleJustification, titlePosition,
907 titleFont, titleColor);