< prev index next >

src/share/classes/com/sun/java/swing/plaf/windows/WindowsTabbedPaneUI.java

Print this page
rev 1580 : 6727661: Code improvement and warnings removing from the swing/plaf packages
Summary: Removed unnecessary castings and other warnings
Reviewed-by: alexp
Contributed-by: Florian Brunner <fbrunnerlist@gmx.ch>


  36 
  37 import static com.sun.java.swing.plaf.windows.TMSchema.*;
  38 import static com.sun.java.swing.plaf.windows.XPStyle.Skin;
  39 
  40 
  41 /**
  42  * Windows rendition of the component.
  43  * <p>
  44  * <strong>Warning:</strong>
  45  * Serialized objects of this class will not be compatible with
  46  * future Swing releases.  The current serialization support is appropriate
  47  * for short term storage or RMI between applications running the same
  48  * version of Swing.  A future release of Swing will provide support for
  49  * long term persistence.
  50  */
  51 public class WindowsTabbedPaneUI extends BasicTabbedPaneUI {
  52     /**
  53      * Keys to use for forward focus traversal when the JComponent is
  54      * managing focus.
  55      */
  56     private static Set managingFocusForwardTraversalKeys;
  57 
  58     /**
  59      * Keys to use for backward focus traversal when the JComponent is
  60      * managing focus.
  61      */
  62     private static Set managingFocusBackwardTraversalKeys;
  63 
  64     private boolean contentOpaque = true;
  65 
  66     protected void installDefaults() {
  67         super.installDefaults();
  68         contentOpaque = UIManager.getBoolean("TabbedPane.contentOpaque");
  69 
  70         // focus forward traversal key
  71         if (managingFocusForwardTraversalKeys==null) {
  72             managingFocusForwardTraversalKeys = new HashSet();
  73             managingFocusForwardTraversalKeys.add(KeyStroke.getKeyStroke(KeyEvent.VK_TAB, 0));
  74         }
  75         tabPane.setFocusTraversalKeys(KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS, managingFocusForwardTraversalKeys);
  76         // focus backward traversal key
  77         if (managingFocusBackwardTraversalKeys==null) {
  78             managingFocusBackwardTraversalKeys = new HashSet();
  79             managingFocusBackwardTraversalKeys.add( KeyStroke.getKeyStroke(KeyEvent.VK_TAB, InputEvent.SHIFT_MASK));
  80         }
  81         tabPane.setFocusTraversalKeys(KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS, managingFocusBackwardTraversalKeys);
  82     }
  83 
  84     protected void uninstallDefaults() {
  85         // sets the focus forward and backward traversal keys to null
  86         // to restore the defaults
  87         tabPane.setFocusTraversalKeys(KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS, null);
  88         tabPane.setFocusTraversalKeys(KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS, null);
  89         super.uninstallDefaults();
  90     }
  91 
  92     public static ComponentUI createUI(JComponent c) {
  93         return new WindowsTabbedPaneUI();
  94     }
  95 
  96     protected void setRolloverTab(int index) {
  97         // Rollover is only supported on XP
  98         if (XPStyle.getXP() != null) {




  36 
  37 import static com.sun.java.swing.plaf.windows.TMSchema.*;
  38 import static com.sun.java.swing.plaf.windows.XPStyle.Skin;
  39 
  40 
  41 /**
  42  * Windows rendition of the component.
  43  * <p>
  44  * <strong>Warning:</strong>
  45  * Serialized objects of this class will not be compatible with
  46  * future Swing releases.  The current serialization support is appropriate
  47  * for short term storage or RMI between applications running the same
  48  * version of Swing.  A future release of Swing will provide support for
  49  * long term persistence.
  50  */
  51 public class WindowsTabbedPaneUI extends BasicTabbedPaneUI {
  52     /**
  53      * Keys to use for forward focus traversal when the JComponent is
  54      * managing focus.
  55      */
  56     private static Set<KeyStroke> managingFocusForwardTraversalKeys;
  57 
  58     /**
  59      * Keys to use for backward focus traversal when the JComponent is
  60      * managing focus.
  61      */
  62     private static Set<KeyStroke> managingFocusBackwardTraversalKeys;
  63 
  64     private boolean contentOpaque = true;
  65 
  66     protected void installDefaults() {
  67         super.installDefaults();
  68         contentOpaque = UIManager.getBoolean("TabbedPane.contentOpaque");
  69 
  70         // focus forward traversal key
  71         if (managingFocusForwardTraversalKeys==null) {
  72             managingFocusForwardTraversalKeys = new HashSet<KeyStroke>();
  73             managingFocusForwardTraversalKeys.add(KeyStroke.getKeyStroke(KeyEvent.VK_TAB, 0));
  74         }
  75         tabPane.setFocusTraversalKeys(KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS, managingFocusForwardTraversalKeys);
  76         // focus backward traversal key
  77         if (managingFocusBackwardTraversalKeys==null) {
  78             managingFocusBackwardTraversalKeys = new HashSet<KeyStroke>();
  79             managingFocusBackwardTraversalKeys.add( KeyStroke.getKeyStroke(KeyEvent.VK_TAB, InputEvent.SHIFT_MASK));
  80         }
  81         tabPane.setFocusTraversalKeys(KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS, managingFocusBackwardTraversalKeys);
  82     }
  83 
  84     protected void uninstallDefaults() {
  85         // sets the focus forward and backward traversal keys to null
  86         // to restore the defaults
  87         tabPane.setFocusTraversalKeys(KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS, null);
  88         tabPane.setFocusTraversalKeys(KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS, null);
  89         super.uninstallDefaults();
  90     }
  91 
  92     public static ComponentUI createUI(JComponent c) {
  93         return new WindowsTabbedPaneUI();
  94     }
  95 
  96     protected void setRolloverTab(int index) {
  97         // Rollover is only supported on XP
  98         if (XPStyle.getXP() != null) {


< prev index next >