1 19 20 package org.netbeans.swing.plaf.gtk; 21 22 import javax.swing.*; 23 import javax.swing.border.Border ; 24 import java.awt.*; 25 import org.netbeans.swing.plaf.util.UIUtils; 26 27 32 public class PartialEdgeBorder implements Border { 33 private Insets ins; 34 35 public PartialEdgeBorder(int width) { 36 ins = new Insets (0,0,0,width); 37 } 38 39 public Insets getBorderInsets(Component c) { 40 return ins; 41 } 42 43 public boolean isBorderOpaque() { 44 return false; 45 } 46 47 public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) { 48 Color ctrl = UIManager.getColor ("control"); Color base = UIManager.getColor("controlShadow"); 50 Color curr; 51 GradientPaint gp = UIUtils.getGradientPaint (x + width - ins.right, y + (height / 2), ctrl, x + width - ins.right, y + height, base, false); 52 ((Graphics2D) g).setPaint (gp); 53 g.drawLine (x + width - ins.right, y + (height / 2), x + width - ins.right, y + height); 54 for (int i=1; i < ins.right-1; i++) { 55 curr = AdaptiveMatteBorder.colorTowards (base, ctrl, ins.right, i + 1); 56 int xpos = x + width - ins.right + i; 57 int ypos = y + (height / 3) + (i * 2); 58 gp = UIUtils.getGradientPaint(xpos, ypos, ctrl, xpos, y + height, curr, false); 59 ((Graphics2D) g).setPaint (gp); 60 g.drawLine (xpos, ypos, xpos, y + height); 61 } 62 } 63 64 } 65 | Popular Tags |