1 23 24 package org.netbeans.swing.plaf.winclassic; 25 26 import javax.swing.*; 27 import javax.swing.border.AbstractBorder ; 28 import java.awt.*; 29 30 34 class StatusLineBorder extends AbstractBorder { 35 36 37 public static final int LEFT = 1; 38 public static final int TOP = 2; 39 public static final int RIGHT = 4; 40 41 private Insets insets; 42 43 private int type; 44 45 47 public StatusLineBorder(int type) { 48 this.type = type; 49 } 50 51 public void paintBorder(Component c, Graphics g, int x, int y, 52 int w, int h) { 53 g.translate(x, y); 54 Color shadowC = UIManager.getColor("controlShadow"); Color highlightC = UIManager.getColor("controlLtHighlight"); Color middleC = UIManager.getColor("control"); if ((type & TOP) != 0) { 59 g.setColor(shadowC); 60 g.drawLine(0, 0, w - 1, 0); 61 g.drawLine(0, 3, w - 1, 3); 62 g.setColor(highlightC); 63 g.drawLine(0, 1, w - 1, 1); 64 g.setColor(middleC); 65 g.drawLine(0, 2, w - 1, 2); 66 } 67 if ((type & LEFT) != 0) { 69 g.setColor(middleC); 70 g.drawLine(0, 2, 0, h - 1); 71 g.setColor(shadowC); 72 g.drawLine(1, 3, 1, h - 1); 73 } 74 if ((type & RIGHT) != 0) { 76 g.setColor(shadowC); 77 g.drawLine(w - 2, 3, w - 2, h - 1); 78 g.setColor(highlightC); 79 g.drawLine(w - 1, 4, w - 1, h - 1); 80 g.setColor(middleC); 81 g.drawLine(w - 1, 3, w - 1, 3); 82 } 83 84 g.translate(-x, -y); 85 } 86 87 public Insets getBorderInsets(Component c) { 88 if (insets == null) { 89 insets = new Insets((type & TOP) != 0 ? 4 : 0, 90 (type & LEFT) != 0 ? 2 : 0, 0, 91 (type & RIGHT) != 0 ? 2 : 0); 92 } 93 return insets; 94 } 95 96 } 97 | Popular Tags |