< prev index next >

src/java.desktop/share/classes/com/sun/java/swing/plaf/windows/WindowsToolBarSeparatorUI.java

Print this page




  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package com.sun.java.swing.plaf.windows;
  27 
  28 import java.awt.*;
  29 
  30 import javax.swing.plaf.ComponentUI;
  31 import javax.swing.plaf.basic.*;
  32 import javax.swing.*;
  33 
  34 import static com.sun.java.swing.plaf.windows.TMSchema.Part;
  35 import static com.sun.java.swing.plaf.windows.XPStyle.Skin;
  36 
  37 
  38 /**
  39  * Draws Windows toolbar separators.
  40  * <p>
  41  *
  42  * @author Mark Davidson
  43  */
  44 public class WindowsToolBarSeparatorUI extends BasicToolBarSeparatorUI {
  45 
  46     public static ComponentUI createUI( JComponent c ) {
  47         return new WindowsToolBarSeparatorUI();
  48     }
  49 
  50     public Dimension getPreferredSize(JComponent c) {
  51         Dimension size = ((JToolBar.Separator)c).getSeparatorSize();
  52 
  53         if (size != null) {
  54             size = size.getSize();
  55         } else {
  56             size = new Dimension(6, 6);
  57             XPStyle xp = XPStyle.getXP();
  58             if (xp != null) {
  59                 boolean vertical = ((JSeparator)c).getOrientation() == SwingConstants.VERTICAL;
  60                 Part part = vertical ? Part.TP_SEPARATOR : Part.TP_SEPARATORVERT;




  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package com.sun.java.swing.plaf.windows;
  27 
  28 import java.awt.*;
  29 
  30 import javax.swing.plaf.ComponentUI;
  31 import javax.swing.plaf.basic.*;
  32 import javax.swing.*;
  33 
  34 import static com.sun.java.swing.plaf.windows.TMSchema.Part;
  35 import static com.sun.java.swing.plaf.windows.XPStyle.Skin;
  36 
  37 
  38 /**
  39  * Draws Windows toolbar separators.

  40  *
  41  * @author Mark Davidson
  42  */
  43 public class WindowsToolBarSeparatorUI extends BasicToolBarSeparatorUI {
  44 
  45     public static ComponentUI createUI( JComponent c ) {
  46         return new WindowsToolBarSeparatorUI();
  47     }
  48 
  49     public Dimension getPreferredSize(JComponent c) {
  50         Dimension size = ((JToolBar.Separator)c).getSeparatorSize();
  51 
  52         if (size != null) {
  53             size = size.getSize();
  54         } else {
  55             size = new Dimension(6, 6);
  56             XPStyle xp = XPStyle.getXP();
  57             if (xp != null) {
  58                 boolean vertical = ((JSeparator)c).getOrientation() == SwingConstants.VERTICAL;
  59                 Part part = vertical ? Part.TP_SEPARATOR : Part.TP_SEPARATORVERT;


< prev index next >