1 19 24 25 package org.netbeans.swing.plaf.aqua; 26 27 import org.netbeans.swing.plaf.util.UIUtils; 28 29 import javax.swing.*; 30 import javax.swing.border.Border ; 31 import java.awt.*; 32 import java.awt.geom.Area ; 33 import java.awt.geom.GeneralPath ; 34 35 40 public class AquaRoundedLowerBorder implements Border { 41 static int ARCSIZE = AquaEditorTabControlBorder.ARCSIZE; 42 43 44 public AquaRoundedLowerBorder() { 45 } 46 47 public Insets getBorderInsets(Component component) { 48 return isFloating(component) ? new Insets (0,0,0,0) : new Insets (0,2,3,2); 49 } 50 51 public boolean isBorderOpaque() { 52 return true; 53 } 54 55 private boolean isFloating (Component c) { 56 boolean result = c.getParent() != null; 57 if (result) { 58 result = c.getParent().getParent() != null; 59 } 60 if (result) { 61 result = c.getParent().getParent() instanceof JLayeredPane; 62 } 63 return result; 64 } 65 66 public void paintBorder(Component c, Graphics g, int x, int y, int w, int h) { 67 if (isFloating(c)) { 68 return; 69 } 70 UIUtils.configureRenderingHints(g); 71 int halfArc = ARCSIZE/2; 72 73 Color col = UIUtils.getMiddle(UIManager.getColor("controlShadow"), 74 UIManager.getColor("control")); 75 76 g.setColor(col); 77 g.drawLine(x, y, x, y+h-halfArc); 78 g.drawLine(x+w-1, y, x+w-1, y+h-halfArc); 79 80 g.drawArc (x, y+h-(ARCSIZE+1), ARCSIZE, ARCSIZE, 180, 90); 81 g.drawArc (x+w-(ARCSIZE+1), y+h-(ARCSIZE+1), ARCSIZE, ARCSIZE, 270, 90); 82 83 g.drawLine (x+(ARCSIZE/2)-3, y+h-1, x+w-(ARCSIZE/2), y+h-1); 84 85 } 86 } 87 | Popular Tags |