< prev index next >

src/java.desktop/share/classes/javax/swing/plaf/metal/MetalSplitPaneDivider.java

Print this page




  23  * questions.
  24  */
  25 
  26 package javax.swing.plaf.metal;
  27 
  28 import java.awt.*;
  29 import javax.swing.*;
  30 import javax.swing.border.*;
  31 import javax.swing.plaf.basic.*;
  32 
  33 
  34 /**
  35  * Metal's split pane divider
  36  * <p>
  37  * <strong>Warning:</strong>
  38  * Serialized objects of this class will not be compatible with
  39  * future Swing releases. The current serialization support is
  40  * appropriate for short term storage or RMI between applications running
  41  * the same version of Swing.  As of 1.4, support for long term storage
  42  * of all JavaBeans&trade;
  43  * has been added to the <code>java.beans</code> package.
  44  * Please see {@link java.beans.XMLEncoder}.
  45  *
  46  * @author Steve Wilson
  47  * @author Ralph kar
  48  */
  49 @SuppressWarnings("serial") // Same-version serialization only
  50 class MetalSplitPaneDivider extends BasicSplitPaneDivider
  51 {
  52     private MetalBumps bumps = new MetalBumps(10, 10,
  53                  MetalLookAndFeel.getControlHighlight(),
  54                  MetalLookAndFeel.getControlDarkShadow(),
  55                  MetalLookAndFeel.getControl() );
  56 
  57     private MetalBumps focusBumps = new MetalBumps(10, 10,
  58                  MetalLookAndFeel.getPrimaryControlHighlight(),
  59                  MetalLookAndFeel.getPrimaryControlDarkShadow(),
  60                  UIManager.getColor("SplitPane.dividerFocusColor"));
  61 
  62     private int inset = 2;
  63 


 182                             }
 183                     }
 184                 }
 185             }
 186 
 187             // Don't want the button to participate in focus traversable.
 188             @SuppressWarnings("deprecation")
 189             public boolean isFocusTraversable() {
 190                 return false;
 191             }
 192         };
 193         b.setRequestFocusEnabled(false);
 194         b.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
 195         b.setFocusPainted(false);
 196         b.setBorderPainted(false);
 197         maybeMakeButtonOpaque(b);
 198         return b;
 199     }
 200 
 201     /**
 202      * If necessary <code>c</code> is made opaque.
 203      */
 204     private void maybeMakeButtonOpaque(JComponent c) {
 205         Object opaque = UIManager.get("SplitPane.oneTouchButtonsOpaque");
 206         if (opaque != null) {
 207             c.setOpaque(((Boolean)opaque).booleanValue());
 208         }
 209     }
 210 
 211     /**
 212      * Creates and return an instance of JButton that can be used to
 213      * collapse the right component in the metal split pane.
 214      */
 215     protected JButton createRightOneTouchButton() {
 216         JButton b = new JButton() {
 217             // Sprite buffer for the arrow image of the right button
 218             int[][]     buffer = {{2, 2, 2, 2, 2, 2, 2, 2},
 219                                   {0, 1, 1, 1, 1, 1, 1, 3},
 220                                   {0, 0, 1, 1, 1, 1, 3, 0},
 221                                   {0, 0, 0, 1, 1, 3, 0, 0},
 222                                   {0, 0, 0, 0, 3, 0, 0, 0}};




  23  * questions.
  24  */
  25 
  26 package javax.swing.plaf.metal;
  27 
  28 import java.awt.*;
  29 import javax.swing.*;
  30 import javax.swing.border.*;
  31 import javax.swing.plaf.basic.*;
  32 
  33 
  34 /**
  35  * Metal's split pane divider
  36  * <p>
  37  * <strong>Warning:</strong>
  38  * Serialized objects of this class will not be compatible with
  39  * future Swing releases. The current serialization support is
  40  * appropriate for short term storage or RMI between applications running
  41  * the same version of Swing.  As of 1.4, support for long term storage
  42  * of all JavaBeans&trade;
  43  * has been added to the {@code java.beans} package.
  44  * Please see {@link java.beans.XMLEncoder}.
  45  *
  46  * @author Steve Wilson
  47  * @author Ralph kar
  48  */
  49 @SuppressWarnings("serial") // Same-version serialization only
  50 class MetalSplitPaneDivider extends BasicSplitPaneDivider
  51 {
  52     private MetalBumps bumps = new MetalBumps(10, 10,
  53                  MetalLookAndFeel.getControlHighlight(),
  54                  MetalLookAndFeel.getControlDarkShadow(),
  55                  MetalLookAndFeel.getControl() );
  56 
  57     private MetalBumps focusBumps = new MetalBumps(10, 10,
  58                  MetalLookAndFeel.getPrimaryControlHighlight(),
  59                  MetalLookAndFeel.getPrimaryControlDarkShadow(),
  60                  UIManager.getColor("SplitPane.dividerFocusColor"));
  61 
  62     private int inset = 2;
  63 


 182                             }
 183                     }
 184                 }
 185             }
 186 
 187             // Don't want the button to participate in focus traversable.
 188             @SuppressWarnings("deprecation")
 189             public boolean isFocusTraversable() {
 190                 return false;
 191             }
 192         };
 193         b.setRequestFocusEnabled(false);
 194         b.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
 195         b.setFocusPainted(false);
 196         b.setBorderPainted(false);
 197         maybeMakeButtonOpaque(b);
 198         return b;
 199     }
 200 
 201     /**
 202      * If necessary {@code c} is made opaque.
 203      */
 204     private void maybeMakeButtonOpaque(JComponent c) {
 205         Object opaque = UIManager.get("SplitPane.oneTouchButtonsOpaque");
 206         if (opaque != null) {
 207             c.setOpaque(((Boolean)opaque).booleanValue());
 208         }
 209     }
 210 
 211     /**
 212      * Creates and return an instance of JButton that can be used to
 213      * collapse the right component in the metal split pane.
 214      */
 215     protected JButton createRightOneTouchButton() {
 216         JButton b = new JButton() {
 217             // Sprite buffer for the arrow image of the right button
 218             int[][]     buffer = {{2, 2, 2, 2, 2, 2, 2, 2},
 219                                   {0, 1, 1, 1, 1, 1, 1, 3},
 220                                   {0, 0, 1, 1, 1, 1, 3, 0},
 221                                   {0, 0, 0, 1, 1, 3, 0, 0},
 222                                   {0, 0, 0, 0, 3, 0, 0, 0}};


< prev index next >