1 19 24 25 package org.netbeans.swing.plaf.winclassic; 26 27 import javax.swing.*; 28 import javax.swing.border.Border ; 29 import java.awt.*; 30 31 35 public class WinClassicCompBorder implements Border { 36 37 private static final Insets insets = new Insets(0, 2, 2, 2); 38 39 public Insets getBorderInsets(Component c) { 40 return insets; 41 } 42 43 public boolean isBorderOpaque() { 44 return true; 45 } 46 47 public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) { 48 int topOffset = 0; 49 if (c instanceof JComponent) { 51 JComponent jc = (JComponent)c; 52 Integer in = (Integer )jc.getClientProperty("MultiViewBorderHack.topOffset"); 53 topOffset = in == null ? topOffset : in.intValue(); 54 } 55 g.translate(x, y); 56 g.setColor(UIManager.getColor("InternalFrame.borderShadow")); g.drawLine(0, 0, 0, height - 1); 58 if (topOffset != 0) { 59 g.drawLine(1, topOffset - 1, 1, topOffset); 60 } 61 g.setColor(UIManager.getColor("InternalFrame.borderDarkShadow")); g.drawLine(1, topOffset, 1, height - 2); 63 g.setColor(UIManager.getColor("InternalFrame.borderHighlight")); g.drawLine(1, height - 1, width - 1, height - 1); 65 g.drawLine(width - 1, height - 2, width - 1, 0); 66 g.setColor(UIManager.getColor("InternalFrame.borderLight")); g.drawLine(2, height - 2, width - 2, height - 2); 68 g.drawLine(width - 2, height - 3, width - 2, 0); 69 g.translate(-x, -y); 70 } 71 72 } 73 | Popular Tags |