1 7 8 package com.sun.java.swing.plaf.windows; 9 10 import java.awt.*; 11 12 import javax.swing.AbstractButton ; 13 import javax.swing.JComponent ; 14 import javax.swing.JToggleButton ; 15 import javax.swing.UIDefaults ; 16 import javax.swing.UIManager ; 17 18 import javax.swing.border.Border ; 19 import javax.swing.border.CompoundBorder ; 20 import javax.swing.border.EmptyBorder ; 21 22 import javax.swing.plaf.*; 23 24 import javax.swing.plaf.basic.BasicBorders ; 25 import javax.swing.plaf.basic.BasicToolBarUI ; 26 27 import com.sun.java.swing.plaf.windows.TMSchema.Part; 28 29 public class WindowsToolBarUI extends BasicToolBarUI { 30 31 public static ComponentUI createUI(JComponent c) { 32 return new WindowsToolBarUI(); 33 } 34 35 protected void installDefaults() { 36 if (XPStyle.getXP() != null) { 37 setRolloverBorders(true); 38 } 39 super.installDefaults(); 40 } 41 42 protected Border createRolloverBorder() { 43 if (XPStyle.getXP() != null) { 44 return new EmptyBorder (3, 3, 3, 3); 45 } else { 46 return super.createRolloverBorder(); 47 } 48 } 49 50 protected Border createNonRolloverBorder() { 51 if (XPStyle.getXP() != null) { 52 return new EmptyBorder (3, 3, 3, 3); 53 } else { 54 return super.createNonRolloverBorder(); 55 } 56 } 57 58 public void paint(Graphics g, JComponent c) { 59 XPStyle xp = XPStyle.getXP(); 60 if (xp != null) { 61 xp.getSkin(c, Part.TP_TOOLBAR).paintSkin(g, 0, 0, c.getWidth(), 62 c.getHeight(), null); 63 } else { 64 super.paint(g, c); 65 } 66 } 67 68 static Border getRolloverBorder(AbstractButton b) { 69 XPStyle xp = XPStyle.getXP(); 70 if (xp != null) { 71 return xp.getBorder(b, WindowsButtonUI.getXPButtonType(b)); 72 } 73 return null; 74 } 75 } 76 77 | Popular Tags |