909 */ 910 public class SizeAction extends AbstractAction { 911 /** 912 * Constructs a new instance of a {@code SizeAction}. 913 */ 914 public SizeAction() { 915 super(UIManager.getString( 916 "InternalFrameTitlePane.sizeButtonText")); 917 } 918 919 public void actionPerformed(ActionEvent e) { 920 // This action is currently undefined 921 } 922 } // end SizeAction 923 924 925 /** 926 * This class should be treated as a "protected" inner class. 927 * Instantiate it only within subclasses of <code>Foo</code>. 928 */ 929 public class SystemMenuBar extends JMenuBar { 930 public boolean isFocusTraversable() { return false; } 931 public void requestFocus() {} 932 public void paint(Graphics g) { 933 Icon icon = frame.getFrameIcon(); 934 if (icon == null) { 935 icon = (Icon)DefaultLookup.get(frame, frame.getUI(), 936 "InternalFrame.icon"); 937 } 938 if (icon != null) { 939 // Resize to 16x16 if necessary. 940 if (icon instanceof ImageIcon && (icon.getIconWidth() > 16 || icon.getIconHeight() > 16)) { 941 Image img = ((ImageIcon)icon).getImage(); 942 ((ImageIcon)icon).setImage(img.getScaledInstance(16, 16, Image.SCALE_SMOOTH)); 943 } 944 icon.paintIcon(this, g, 0, 0); 945 } 946 } 947 948 public boolean isOpaque() { 949 return true; 950 } 951 } // end SystemMenuBar 952 953 954 private class NoFocusButton extends JButton { 955 private String uiKey; 956 public NoFocusButton(String uiKey, String opacityKey) { 957 setFocusPainted(false); 958 setMargin(new Insets(0,0,0,0)); 959 this.uiKey = uiKey; 960 961 Object opacity = UIManager.get(opacityKey); 962 if (opacity instanceof Boolean) { 963 setOpaque(((Boolean)opacity).booleanValue()); 964 } 965 } 966 public boolean isFocusTraversable() { return false; } 967 public void requestFocus() {} 968 public AccessibleContext getAccessibleContext() { 969 AccessibleContext ac = super.getAccessibleContext(); 970 if (uiKey != null) { 971 ac.setAccessibleName(UIManager.getString(uiKey)); 972 uiKey = null; 973 } 974 return ac; 975 } 976 } // end NoFocusButton 977 978 } // End Title Pane Class | 909 */ 910 public class SizeAction extends AbstractAction { 911 /** 912 * Constructs a new instance of a {@code SizeAction}. 913 */ 914 public SizeAction() { 915 super(UIManager.getString( 916 "InternalFrameTitlePane.sizeButtonText")); 917 } 918 919 public void actionPerformed(ActionEvent e) { 920 // This action is currently undefined 921 } 922 } // end SizeAction 923 924 925 /** 926 * This class should be treated as a "protected" inner class. 927 * Instantiate it only within subclasses of <code>Foo</code>. 928 */ 929 @SuppressWarnings("deprecation") 930 public class SystemMenuBar extends JMenuBar { 931 public boolean isFocusTraversable() { return false; } 932 public void requestFocus() {} 933 public void paint(Graphics g) { 934 Icon icon = frame.getFrameIcon(); 935 if (icon == null) { 936 icon = (Icon)DefaultLookup.get(frame, frame.getUI(), 937 "InternalFrame.icon"); 938 } 939 if (icon != null) { 940 // Resize to 16x16 if necessary. 941 if (icon instanceof ImageIcon && (icon.getIconWidth() > 16 || icon.getIconHeight() > 16)) { 942 Image img = ((ImageIcon)icon).getImage(); 943 ((ImageIcon)icon).setImage(img.getScaledInstance(16, 16, Image.SCALE_SMOOTH)); 944 } 945 icon.paintIcon(this, g, 0, 0); 946 } 947 } 948 949 public boolean isOpaque() { 950 return true; 951 } 952 } // end SystemMenuBar 953 954 955 private class NoFocusButton extends JButton { 956 private String uiKey; 957 public NoFocusButton(String uiKey, String opacityKey) { 958 setFocusPainted(false); 959 setMargin(new Insets(0,0,0,0)); 960 this.uiKey = uiKey; 961 962 Object opacity = UIManager.get(opacityKey); 963 if (opacity instanceof Boolean) { 964 setOpaque(((Boolean)opacity).booleanValue()); 965 } 966 } 967 @SuppressWarnings("deprecation") 968 public boolean isFocusTraversable() { return false; } 969 public void requestFocus() {} 970 public AccessibleContext getAccessibleContext() { 971 AccessibleContext ac = super.getAccessibleContext(); 972 if (uiKey != null) { 973 ac.setAccessibleName(UIManager.getString(uiKey)); 974 uiKey = null; 975 } 976 return ac; 977 } 978 } // end NoFocusButton 979 980 } // End Title Pane Class |