709 |
super(tileIcon); |
super(tileIcon); |
710 |
} |
} |
711 |
} |
} |
712 |
|
|
713 |
|
|
714 |
|
/** |
715 |
|
* A {@link javax.swing.border.TitledBorder} that also implements the |
716 |
|
* {@link UIResource} marker interface. This is useful for |
717 |
|
* implementing pluggable look-and-feels: When switching the current |
718 |
|
* LookAndFeel, only those borders are replaced that are marked as |
719 |
|
* {@link UIResource}. For this reason, a look-and-feel should |
720 |
|
* always install borders that implement <code>UIResource</code>, |
721 |
|
* such as the borders provided by this class. |
722 |
|
* |
723 |
|
* @author Brian Jones (cbj@gnu.org) |
724 |
|
* @author Sascha Brawer (brawer@dandelis.ch) |
725 |
|
*/ |
726 |
|
public static class TitledBorderUIResource |
727 |
|
extends TitledBorder |
728 |
|
implements UIResource, Serializable |
729 |
|
{ |
730 |
|
/** |
731 |
|
* Constructs a TitledBorderUIResource given the text of its title. |
732 |
|
* |
733 |
|
* @param title the title text, or <code>null</code> to use no |
734 |
|
* title text. |
735 |
|
*/ |
736 |
|
public TitledBorderUIResource(String title) |
737 |
|
{ |
738 |
|
super(title); |
739 |
|
} |
740 |
|
|
741 |
|
|
742 |
|
/** |
743 |
|
* Constructs an initially untitled TitledBorderUIResource |
744 |
|
* given another border. |
745 |
|
* |
746 |
|
* @param border the border underneath the title, or |
747 |
|
* <code>null</code> to use a default from |
748 |
|
* the current look and feel. |
749 |
|
*/ |
750 |
|
public TitledBorderUIResource(Border border) |
751 |
|
{ |
752 |
|
super(border); |
753 |
|
} |
754 |
|
|
755 |
|
|
756 |
|
/** |
757 |
|
* Constructs a TitledBorder given its border and title text. |
758 |
|
* |
759 |
|
* @param border the border underneath the title, or |
760 |
|
* <code>null</code> to use a default from |
761 |
|
* the current look and feel. |
762 |
|
* |
763 |
|
* @param title the title text, or <code>null</code> |
764 |
|
* to use no title text. |
765 |
|
*/ |
766 |
|
public TitledBorderUIResource(Border border, String title) |
767 |
|
{ |
768 |
|
super(border, title); |
769 |
|
} |
770 |
|
|
771 |
|
|
772 |
/** |
/** |
773 |
* @serial |
* Constructs a TitledBorderUIResource given its border, title |
774 |
|
* text, horizontal alignment, and vertical position. |
775 |
|
* |
776 |
|
* @param border the border underneath the title, or |
777 |
|
* <code>null</code> to use a default |
778 |
|
* from the current look and feel. |
779 |
|
* |
780 |
|
* @param title the title text, or <code>null</code> |
781 |
|
* to use no title text. |
782 |
|
* |
783 |
|
* @param titleJustification the horizontal alignment of the title |
784 |
|
* text in relation to the border. The value must be one of |
785 |
|
* {@link javax.swing.border.TitledBorder#LEFT}, |
786 |
|
* {@link javax.swing.border.TitledBorder#CENTER}, |
787 |
|
* {@link javax.swing.border.TitledBorder#RIGHT}, |
788 |
|
* {@link javax.swing.border.TitledBorder#LEADING}, |
789 |
|
* {@link javax.swing.border.TitledBorder#TRAILING}, or |
790 |
|
* {@link javax.swing.border.TitledBorder#DEFAULT_JUSTIFICATION}. |
791 |
|
* |
792 |
|
* @param titlePosition the vertical position of the title text |
793 |
|
* in relation to the border. The value must be one of |
794 |
|
* {@link javax.swing.border.TitledBorder#ABOVE_TOP}, |
795 |
|
* {@link javax.swing.border.TitledBorder#TOP}, |
796 |
|
* {@link javax.swing.border.TitledBorder#BELOW_TOP}, |
797 |
|
* {@link javax.swing.border.TitledBorder#ABOVE_BOTTOM}, |
798 |
|
* {@link javax.swing.border.TitledBorder#BOTTOM}, |
799 |
|
* {@link javax.swing.border.TitledBorder#BELOW_BOTTOM}, |
800 |
|
* or {@link javax.swing.border.TitledBorder#DEFAULT_POSITION}. |
801 |
|
* |
802 |
|
* @throws IllegalArgumentException if <code>titleJustification</code> |
803 |
|
* or <code>titlePosition</code> have an unsupported value. |
804 |
*/ |
*/ |
805 |
public static class TitledBorderUIResource |
public TitledBorderUIResource(Border border, String title, |
806 |
extends TitledBorder |
int titleJustification, |
807 |
implements UIResource, Serializable |
int titlePosition) |
808 |
{ |
{ |
809 |
TitledBorderUIResource(String title) |
super(border, title, titleJustification, titlePosition); |
810 |
{ |
} |
811 |
super (title); |
|
812 |
} |
|
813 |
TitledBorderUIResource(Border border) |
/** |
814 |
{ |
* Constructs a TitledBorder given its border, title text, |
815 |
super (border); |
* horizontal alignment, vertical position, and font. |
816 |
} |
* |
817 |
TitledBorderUIResource(Border border, String title) |
* @param border the border underneath the title, or |
818 |
{ |
* <code>null</code> to use a default |
819 |
super (border, title); |
* from the current look and feel. |
820 |
} |
* |
821 |
TitledBorderUIResource(Border border, String title, |
* @param title the title text, or <code>null</code> |
822 |
int titleJustification, int titlePosition) |
* to use no title text. |
823 |
{ |
* |
824 |
super (border, title, titleJustification, titlePosition); |
* @param titleJustification the horizontal alignment of the title |
825 |
} |
* text in relation to the border. The value must be one of |
826 |
TitledBorderUIResource(Border border, String title, |
* {@link javax.swing.border.TitledBorder#LEFT}, |
827 |
int titleJustification, int titlePosition, |
* {@link javax.swing.border.TitledBorder#CENTER}, |
828 |
Font titleFont) |
* {@link javax.swing.border.TitledBorder#RIGHT}, |
829 |
{ |
* {@link javax.swing.border.TitledBorder#LEADING}, |
830 |
super (border, title, titleJustification, titlePosition, titleFont); |
* {@link javax.swing.border.TitledBorder#TRAILING}, or |
831 |
} |
* {@link javax.swing.border.TitledBorder#DEFAULT_JUSTIFICATION}. |
832 |
TitledBorderUIResource(Border border, String title, |
* |
833 |
int titleJustification, int titlePosition, |
* @param titlePosition the vertical position of the title text |
834 |
Font titleFont, Color titleColor) |
* in relation to the border. The value must be one of |
835 |
{ |
* {@link javax.swing.border.TitledBorder#ABOVE_TOP}, |
836 |
super (border, title, titleJustification, titlePosition, titleFont, titleColor); |
* {@link javax.swing.border.TitledBorder#TOP}, |
837 |
} |
* {@link javax.swing.border.TitledBorder#BELOW_TOP}, |
838 |
|
* {@link javax.swing.border.TitledBorder#ABOVE_BOTTOM}, |
839 |
|
* {@link javax.swing.border.TitledBorder#BOTTOM}, |
840 |
|
* {@link javax.swing.border.TitledBorder#BELOW_BOTTOM}, |
841 |
|
* or {@link javax.swing.border.TitledBorder#DEFAULT_POSITION}. |
842 |
|
* |
843 |
|
* @param titleFont the font for the title text, or <code>null</code> |
844 |
|
* to use a default from the current look and feel. |
845 |
|
* |
846 |
|
* @throws IllegalArgumentException if <code>titleJustification</code> |
847 |
|
* or <code>titlePosition</code> have an unsupported value. |
848 |
|
*/ |
849 |
|
public TitledBorderUIResource(Border border, String title, |
850 |
|
int titleJustification, |
851 |
|
int titlePosition, |
852 |
|
Font titleFont) |
853 |
|
{ |
854 |
|
super(border, title, titleJustification, titlePosition, |
855 |
|
titleFont); |
856 |
|
} |
857 |
|
|
858 |
|
|
859 |
|
/** |
860 |
|
* Constructs a TitledBorder given its border, title text, |
861 |
|
* horizontal alignment, vertical position, font, and color. |
862 |
|
* |
863 |
|
* @param border the border underneath the title, or |
864 |
|
* <code>null</code> to use a default |
865 |
|
* from the current look and feel. |
866 |
|
* |
867 |
|
* @param title the title text, or <code>null</code> |
868 |
|
* to use no title text. |
869 |
|
* |
870 |
|
* @param titleJustification the horizontal alignment of the title |
871 |
|
* text in relation to the border. The value must be one of |
872 |
|
* {@link javax.swing.border.TitledBorder#LEFT}, |
873 |
|
* {@link javax.swing.border.TitledBorder#CENTER}, |
874 |
|
* {@link javax.swing.border.TitledBorder#RIGHT}, |
875 |
|
* {@link javax.swing.border.TitledBorder#LEADING}, |
876 |
|
* {@link javax.swing.border.TitledBorder#TRAILING}, or |
877 |
|
* {@link javax.swing.border.TitledBorder#DEFAULT_JUSTIFICATION}. |
878 |
|
* |
879 |
|
* @param titlePosition the vertical position of the title text |
880 |
|
* in relation to the border. The value must be one of |
881 |
|
* {@link javax.swing.border.TitledBorder#ABOVE_TOP}, |
882 |
|
* {@link javax.swing.border.TitledBorder#TOP}, |
883 |
|
* {@link javax.swing.border.TitledBorder#BELOW_TOP}, |
884 |
|
* {@link javax.swing.border.TitledBorder#ABOVE_BOTTOM}, |
885 |
|
* {@link javax.swing.border.TitledBorder#BOTTOM}, |
886 |
|
* {@link javax.swing.border.TitledBorder#BELOW_BOTTOM}, |
887 |
|
* or {@link javax.swing.border.TitledBorder#DEFAULT_POSITION}. |
888 |
|
* |
889 |
|
* @param titleFont the font for the title text, or <code>null</code> |
890 |
|
* to use a default from the current look and feel. |
891 |
|
* |
892 |
|
* @param titleColor the color for the title text, or <code>null</code> |
893 |
|
* to use a default from the current look and feel. |
894 |
|
* |
895 |
|
* @throws IllegalArgumentException if <code>titleJustification</code> |
896 |
|
* or <code>titlePosition</code> have an unsupported value. |
897 |
|
*/ |
898 |
|
public TitledBorderUIResource(Border border, String title, |
899 |
|
int titleJustification, int titlePosition, |
900 |
|
Font titleFont, Color titleColor) |
901 |
|
{ |
902 |
|
super(border, title, titleJustification, titlePosition, |
903 |
|
titleFont, titleColor); |
904 |
} |
} |
905 |
|
} |
906 |
} |
} |
907 |
|
|