1 19 20 package org.netbeans.modules.options.ui; 21 22 23 import java.awt.Color ; 24 import java.awt.Component ; 25 import java.awt.Graphics ; 26 import java.awt.Insets ; 27 import java.awt.SystemColor ; 28 import javax.swing.border.Border ; 29 30 31 35 public class DashedBorder implements Border { 36 37 private Insets insets = new Insets (1, 1, 1, 1); 38 39 40 public void paintBorder ( 41 Component c, 42 Graphics g, 43 int x, int y, int width, int height 44 ) { 45 int vx,vy; 46 Color old = g.getColor (); 47 g.setColor (Color.black); 48 49 for (vx = x; vx < (x + width); vx+=2) { 51 g.fillRect(vx, y, 1, 1); 52 g.fillRect(vx, y + height-1, 1, 1); 53 } 54 55 for (vy = y; vy < (y + height); vy+=2) { 57 g.fillRect(x, vy, 1, 1); 58 g.fillRect(x+width-1, vy, 1, 1); 59 } 60 g.setColor (old); 61 } 62 63 public Insets getBorderInsets (Component c) { 64 return insets; 65 } 66 67 public boolean isBorderOpaque () { 68 return true; 69 } 70 } 71 | Popular Tags |