equal
deleted
inserted
replaced
54 * indicator. Only used with the Ocean theme. |
54 * indicator. Only used with the Ocean theme. |
55 */ |
55 */ |
56 static Object NO_BUTTON_ROLLOVER = |
56 static Object NO_BUTTON_ROLLOVER = |
57 new StringUIClientPropertyKey("NoButtonRollover"); |
57 new StringUIClientPropertyKey("NoButtonRollover"); |
58 |
58 |
|
59 /** |
|
60 * The class represents the 3D border. |
|
61 */ |
59 @SuppressWarnings("serial") // Superclass is not serializable across versions |
62 @SuppressWarnings("serial") // Superclass is not serializable across versions |
60 public static class Flush3DBorder extends AbstractBorder implements UIResource{ |
63 public static class Flush3DBorder extends AbstractBorder implements UIResource{ |
61 public void paintBorder(Component c, Graphics g, int x, int y, |
64 public void paintBorder(Component c, Graphics g, int x, int y, |
62 int w, int h) { |
65 int w, int h) { |
63 if (c.isEnabled()) { |
66 if (c.isEnabled()) { |
71 newInsets.set(2, 2, 2, 2); |
74 newInsets.set(2, 2, 2, 2); |
72 return newInsets; |
75 return newInsets; |
73 } |
76 } |
74 } |
77 } |
75 |
78 |
|
79 /** |
|
80 * The class represents the border of a {@code JButton}. |
|
81 */ |
76 @SuppressWarnings("serial") // Superclass is not serializable across versions |
82 @SuppressWarnings("serial") // Superclass is not serializable across versions |
77 public static class ButtonBorder extends AbstractBorder implements UIResource { |
83 public static class ButtonBorder extends AbstractBorder implements UIResource { |
78 |
84 |
|
85 /** |
|
86 * The border insets. |
|
87 */ |
79 protected static Insets borderInsets = new Insets( 3, 3, 3, 3 ); |
88 protected static Insets borderInsets = new Insets( 3, 3, 3, 3 ); |
80 |
89 |
81 public void paintBorder(Component c, Graphics g, int x, int y, int w, int h) { |
90 public void paintBorder(Component c, Graphics g, int x, int y, int w, int h) { |
82 if (!(c instanceof AbstractButton)) { |
91 if (!(c instanceof AbstractButton)) { |
83 return; |
92 return; |
186 newInsets.set(3, 3, 3, 3); |
195 newInsets.set(3, 3, 3, 3); |
187 return newInsets; |
196 return newInsets; |
188 } |
197 } |
189 } |
198 } |
190 |
199 |
|
200 /** |
|
201 * The class represents the border of a {@code JInternalFrame}. |
|
202 */ |
191 @SuppressWarnings("serial") // Superclass is not serializable across versions |
203 @SuppressWarnings("serial") // Superclass is not serializable across versions |
192 public static class InternalFrameBorder extends AbstractBorder implements UIResource { |
204 public static class InternalFrameBorder extends AbstractBorder implements UIResource { |
193 private static final int corner = 14; |
205 private static final int corner = 14; |
194 |
206 |
195 public void paintBorder(Component c, Graphics g, int x, int y, |
207 public void paintBorder(Component c, Graphics g, int x, int y, |
468 newInsets.set(1, 1, 1, 1); |
480 newInsets.set(1, 1, 1, 1); |
469 return newInsets; |
481 return newInsets; |
470 } |
482 } |
471 } |
483 } |
472 |
484 |
|
485 /** |
|
486 * The class represents the border of an option dialog. |
|
487 */ |
473 @SuppressWarnings("serial") // Superclass is not serializable across versions |
488 @SuppressWarnings("serial") // Superclass is not serializable across versions |
474 public static class OptionDialogBorder extends AbstractBorder implements UIResource { |
489 public static class OptionDialogBorder extends AbstractBorder implements UIResource { |
475 int titleHeight = 0; |
490 int titleHeight = 0; |
476 |
491 |
477 public void paintBorder( Component c, Graphics g, int x, int y, int w, int h ) { |
492 public void paintBorder( Component c, Graphics g, int x, int y, int w, int h ) { |
530 newInsets.set(3, 3, 3, 3); |
545 newInsets.set(3, 3, 3, 3); |
531 return newInsets; |
546 return newInsets; |
532 } |
547 } |
533 } |
548 } |
534 |
549 |
|
550 /** |
|
551 * The class represents the border of a {@code JMenuBar}. |
|
552 */ |
535 @SuppressWarnings("serial") // Superclass is not serializable across versions |
553 @SuppressWarnings("serial") // Superclass is not serializable across versions |
536 public static class MenuBarBorder extends AbstractBorder implements UIResource { |
554 public static class MenuBarBorder extends AbstractBorder implements UIResource { |
|
555 |
|
556 /** |
|
557 * The border insets. |
|
558 */ |
537 protected static Insets borderInsets = new Insets( 1, 0, 1, 0 ); |
559 protected static Insets borderInsets = new Insets( 1, 0, 1, 0 ); |
538 |
560 |
539 public void paintBorder( Component c, Graphics g, int x, int y, int w, int h ) { |
561 public void paintBorder( Component c, Graphics g, int x, int y, int w, int h ) { |
540 g.translate( x, y ); |
562 g.translate( x, y ); |
541 |
563 |
567 } |
589 } |
568 return newInsets; |
590 return newInsets; |
569 } |
591 } |
570 } |
592 } |
571 |
593 |
|
594 /** |
|
595 * The class represents the border of a {@code JMenuItem}. |
|
596 */ |
572 @SuppressWarnings("serial") // Superclass is not serializable across versions |
597 @SuppressWarnings("serial") // Superclass is not serializable across versions |
573 public static class MenuItemBorder extends AbstractBorder implements UIResource { |
598 public static class MenuItemBorder extends AbstractBorder implements UIResource { |
|
599 |
|
600 /** |
|
601 * The border insets. |
|
602 */ |
574 protected static Insets borderInsets = new Insets( 2, 2, 2, 2 ); |
603 protected static Insets borderInsets = new Insets( 2, 2, 2, 2 ); |
575 |
604 |
576 public void paintBorder( Component c, Graphics g, int x, int y, int w, int h ) { |
605 public void paintBorder( Component c, Graphics g, int x, int y, int w, int h ) { |
577 if (!(c instanceof JMenuItem)) { |
606 if (!(c instanceof JMenuItem)) { |
578 return; |
607 return; |
615 newInsets.set(2, 2, 2, 2); |
644 newInsets.set(2, 2, 2, 2); |
616 return newInsets; |
645 return newInsets; |
617 } |
646 } |
618 } |
647 } |
619 |
648 |
|
649 /** |
|
650 * The class represents the border of a {@code JPopupMenu}. |
|
651 */ |
620 @SuppressWarnings("serial") // Superclass is not serializable across versions |
652 @SuppressWarnings("serial") // Superclass is not serializable across versions |
621 public static class PopupMenuBorder extends AbstractBorder implements UIResource { |
653 public static class PopupMenuBorder extends AbstractBorder implements UIResource { |
|
654 |
|
655 /** |
|
656 * The border insets. |
|
657 */ |
622 protected static Insets borderInsets = new Insets( 3, 1, 2, 1 ); |
658 protected static Insets borderInsets = new Insets( 3, 1, 2, 1 ); |
623 |
659 |
624 public void paintBorder( Component c, Graphics g, int x, int y, int w, int h ) { |
660 public void paintBorder( Component c, Graphics g, int x, int y, int w, int h ) { |
625 g.translate( x, y ); |
661 g.translate( x, y ); |
626 |
662 |
640 newInsets.set(3, 1, 2, 1); |
676 newInsets.set(3, 1, 2, 1); |
641 return newInsets; |
677 return newInsets; |
642 } |
678 } |
643 } |
679 } |
644 |
680 |
|
681 /** |
|
682 * The class represents the border of a rollover {@code Button}. |
|
683 */ |
645 @SuppressWarnings("serial") // Superclass is not serializable across versions |
684 @SuppressWarnings("serial") // Superclass is not serializable across versions |
646 public static class RolloverButtonBorder extends ButtonBorder { |
685 public static class RolloverButtonBorder extends ButtonBorder { |
647 |
686 |
648 public void paintBorder( Component c, Graphics g, int x, int y, int w, int h ) { |
687 public void paintBorder( Component c, Graphics g, int x, int y, int w, int h ) { |
649 AbstractButton b = (AbstractButton) c; |
688 AbstractButton b = (AbstractButton) c; |
691 } |
730 } |
692 return insets; |
731 return insets; |
693 } |
732 } |
694 } |
733 } |
695 |
734 |
|
735 /** |
|
736 * The class represents the border of a {@code JToolBar}. |
|
737 */ |
696 @SuppressWarnings("serial") // Superclass is not serializable across versions |
738 @SuppressWarnings("serial") // Superclass is not serializable across versions |
697 public static class ToolBarBorder extends AbstractBorder implements UIResource, SwingConstants |
739 public static class ToolBarBorder extends AbstractBorder implements UIResource, SwingConstants |
698 { |
740 { |
|
741 /** |
|
742 * The instance of {@code MetalBumps}. |
|
743 */ |
699 protected MetalBumps bumps = new MetalBumps( 10, 10, |
744 protected MetalBumps bumps = new MetalBumps( 10, 10, |
700 MetalLookAndFeel.getControlHighlight(), |
745 MetalLookAndFeel.getControlHighlight(), |
701 MetalLookAndFeel.getControlDarkShadow(), |
746 MetalLookAndFeel.getControlDarkShadow(), |
702 UIManager.getColor("ToolBar.background")); |
747 UIManager.getColor("ToolBar.background")); |
703 |
748 |
777 } |
822 } |
778 |
823 |
779 private static Border buttonBorder; |
824 private static Border buttonBorder; |
780 |
825 |
781 /** |
826 /** |
782 * Returns a border instance for a JButton |
827 * Returns a border instance for a {@code JButton}. |
|
828 * |
|
829 * @return a border instance for a {@code JButton} |
783 * @since 1.3 |
830 * @since 1.3 |
784 */ |
831 */ |
785 public static Border getButtonBorder() { |
832 public static Border getButtonBorder() { |
786 if (buttonBorder == null) { |
833 if (buttonBorder == null) { |
787 buttonBorder = new BorderUIResource.CompoundBorderUIResource( |
834 buttonBorder = new BorderUIResource.CompoundBorderUIResource( |
792 } |
839 } |
793 |
840 |
794 private static Border textBorder; |
841 private static Border textBorder; |
795 |
842 |
796 /** |
843 /** |
797 * Returns a border instance for a text component |
844 * Returns a border instance for a text component. |
|
845 * |
|
846 * @return a border instance for a text component |
798 * @since 1.3 |
847 * @since 1.3 |
799 */ |
848 */ |
800 public static Border getTextBorder() { |
849 public static Border getTextBorder() { |
801 if (textBorder == null) { |
850 if (textBorder == null) { |
802 textBorder = new BorderUIResource.CompoundBorderUIResource( |
851 textBorder = new BorderUIResource.CompoundBorderUIResource( |
807 } |
856 } |
808 |
857 |
809 private static Border textFieldBorder; |
858 private static Border textFieldBorder; |
810 |
859 |
811 /** |
860 /** |
812 * Returns a border instance for a JTextField |
861 * Returns a border instance for a {@code JTextField}. |
|
862 * |
|
863 * @return a border instance for a {@code JTextField} |
813 * @since 1.3 |
864 * @since 1.3 |
814 */ |
865 */ |
815 public static Border getTextFieldBorder() { |
866 public static Border getTextFieldBorder() { |
816 if (textFieldBorder == null) { |
867 if (textFieldBorder == null) { |
817 textFieldBorder = new BorderUIResource.CompoundBorderUIResource( |
868 textFieldBorder = new BorderUIResource.CompoundBorderUIResource( |
819 new BasicBorders.MarginBorder()); |
870 new BasicBorders.MarginBorder()); |
820 } |
871 } |
821 return textFieldBorder; |
872 return textFieldBorder; |
822 } |
873 } |
823 |
874 |
|
875 /** |
|
876 * The class represents the border of a {@code JTestField}. |
|
877 */ |
824 @SuppressWarnings("serial") // Superclass is not serializable across versions |
878 @SuppressWarnings("serial") // Superclass is not serializable across versions |
825 public static class TextFieldBorder extends Flush3DBorder { |
879 public static class TextFieldBorder extends Flush3DBorder { |
826 |
880 |
827 public void paintBorder(Component c, Graphics g, int x, int y, |
881 public void paintBorder(Component c, Graphics g, int x, int y, |
828 int w, int h) { |
882 int w, int h) { |
844 } |
898 } |
845 |
899 |
846 } |
900 } |
847 } |
901 } |
848 |
902 |
|
903 /** |
|
904 * The class represents the border of a {@code JScrollPane}. |
|
905 */ |
849 @SuppressWarnings("serial") // Superclass is not serializable across versions |
906 @SuppressWarnings("serial") // Superclass is not serializable across versions |
850 public static class ScrollPaneBorder extends AbstractBorder implements UIResource { |
907 public static class ScrollPaneBorder extends AbstractBorder implements UIResource { |
851 public void paintBorder(Component c, Graphics g, int x, int y, |
908 public void paintBorder(Component c, Graphics g, int x, int y, |
852 int w, int h) { |
909 int w, int h) { |
853 |
910 |
890 } |
947 } |
891 |
948 |
892 private static Border toggleButtonBorder; |
949 private static Border toggleButtonBorder; |
893 |
950 |
894 /** |
951 /** |
895 * Returns a border instance for a JToggleButton |
952 * Returns a border instance for a {@code JToggleButton}. |
|
953 * |
|
954 * @return a border instance for a {@code JToggleButton} |
896 * @since 1.3 |
955 * @since 1.3 |
897 */ |
956 */ |
898 public static Border getToggleButtonBorder() { |
957 public static Border getToggleButtonBorder() { |
899 if (toggleButtonBorder == null) { |
958 if (toggleButtonBorder == null) { |
900 toggleButtonBorder = new BorderUIResource.CompoundBorderUIResource( |
959 toggleButtonBorder = new BorderUIResource.CompoundBorderUIResource( |
940 * Border for a Table Header |
999 * Border for a Table Header |
941 * @since 1.3 |
1000 * @since 1.3 |
942 */ |
1001 */ |
943 @SuppressWarnings("serial") // Superclass is not serializable across versions |
1002 @SuppressWarnings("serial") // Superclass is not serializable across versions |
944 public static class TableHeaderBorder extends javax.swing.border.AbstractBorder { |
1003 public static class TableHeaderBorder extends javax.swing.border.AbstractBorder { |
|
1004 |
|
1005 /** |
|
1006 * The border insets. |
|
1007 */ |
945 protected Insets editorBorderInsets = new Insets( 2, 2, 2, 0 ); |
1008 protected Insets editorBorderInsets = new Insets( 2, 2, 2, 0 ); |
946 |
1009 |
947 public void paintBorder(Component c, Graphics g, int x, int y, int w, int h) { |
1010 public void paintBorder(Component c, Graphics g, int x, int y, int w, int h) { |
948 g.translate( x, y ); |
1011 g.translate( x, y ); |
949 |
1012 |
962 return insets; |
1025 return insets; |
963 } |
1026 } |
964 } |
1027 } |
965 |
1028 |
966 /** |
1029 /** |
967 * Returns a border instance for a Desktop Icon |
1030 * Returns a border instance for a Desktop Icon. |
|
1031 * |
|
1032 * @return a border instance for a Desktop Icon |
968 * @since 1.3 |
1033 * @since 1.3 |
969 */ |
1034 */ |
970 public static Border getDesktopIconBorder() { |
1035 public static Border getDesktopIconBorder() { |
971 return new BorderUIResource.CompoundBorderUIResource( |
1036 return new BorderUIResource.CompoundBorderUIResource( |
972 new LineBorder(MetalLookAndFeel.getControlDarkShadow(), 1), |
1037 new LineBorder(MetalLookAndFeel.getControlDarkShadow(), 1), |