1 7 8 package javax.swing.plaf.basic; 9 10 import javax.swing.*; 11 import java.awt.Color ; 12 import java.awt.Dimension ; 13 import java.awt.Graphics ; 14 import java.awt.Insets ; 15 import java.awt.Rectangle ; 16 import javax.swing.JToolBar ; 17 import javax.swing.plaf.*; 18 import javax.swing.plaf.basic.BasicSeparatorUI ; 19 20 21 29 30 public class BasicToolBarSeparatorUI extends BasicSeparatorUI 31 { 32 public static ComponentUI createUI( JComponent c ) 33 { 34 return new BasicToolBarSeparatorUI (); 35 } 36 37 protected void installDefaults( JSeparator s ) 38 { 39 Dimension size = ( (JToolBar.Separator )s ).getSeparatorSize(); 40 41 if ( size == null || size instanceof UIResource ) 42 { 43 JToolBar.Separator sep = (JToolBar.Separator )s; 44 size = (Dimension )(UIManager.get("ToolBar.separatorSize")); 45 if (size != null) { 46 if (sep.getOrientation() == JSeparator.HORIZONTAL) { 47 size = new Dimension (size.height, size.width); 48 } 49 sep.setSeparatorSize(size); 50 } 51 } 52 } 53 54 public void paint( Graphics g, JComponent c ) 55 { 56 } 57 58 public Dimension getPreferredSize( JComponent c ) 59 { 60 Dimension size = ( (JToolBar.Separator )c ).getSeparatorSize(); 61 62 if ( size != null ) 63 { 64 return size.getSize(); 65 } 66 else 67 { 68 return null; 69 } 70 } 71 } 72 73 74 75 | Popular Tags |