1 19 24 25 package org.netbeans.swing.plaf.aqua; 26 27 import java.awt.Color ; 28 import java.awt.Dimension ; 29 import java.awt.Graphics ; 30 import javax.swing.JComponent ; 31 import javax.swing.JPopupMenu ; 32 import javax.swing.plaf.ComponentUI ; 33 import javax.swing.plaf.SeparatorUI ; 34 35 43 public class AquaSeparatorUI extends SeparatorUI { 44 private final static Color lineColor = new Color (215, 215, 215); 45 46 private static ComponentUI separatorui = new AquaSeparatorUI(); 47 48 public static ComponentUI createUI(JComponent c) { 49 return separatorui; 50 } 51 52 public void paint( Graphics g, JComponent c ) { 53 if (c.getParent() instanceof JPopupMenu ) { 54 Dimension s = c.getSize(); 55 56 g.setColor(lineColor); 57 g.drawLine(1, 5, s.width - 2, 5); 58 } 59 } 60 61 public Dimension getPreferredSize(JComponent c) { 62 Dimension s; 63 if (c.getParent() instanceof JPopupMenu ) { 64 return new Dimension ( 0, 12 ); 65 } else { 66 s = new Dimension (0, 0); 67 } 68 69 return s; 70 } 71 72 public Dimension getMinimumSize( JComponent c ) { return null; } 73 public Dimension getMaximumSize( JComponent c ) { return null; } 74 } 75 | Popular Tags |