1 19 package org.netbeans.modules.xml.wsdl.ui.view.grapheditor.widget; 20 21 import java.awt.Color ; 22 import java.awt.Dimension ; 23 import java.awt.Insets ; 24 25 import org.netbeans.api.visual.border.BorderFactory; 26 import org.netbeans.api.visual.widget.Scene; 27 import org.netbeans.api.visual.widget.Widget; 28 import org.netbeans.modules.xml.wsdl.ui.view.grapheditor.border.FilledBorder; 29 30 35 public class RectangleWidget extends Widget { 36 37 private int _width = 10; 38 private int _height = 67; 39 private int _x = 0; 40 private int _y = 0; 41 private int _thickness = 1; 42 private Color _color = new Color (0x3244A0); 43 44 public RectangleWidget(Scene scene) { 45 super(scene); 46 setOpaque(false); 47 } 48 49 public RectangleWidget(Scene scene, int width, int height) { 50 this(scene); 51 _width = width; 52 _height = height; 53 refreshBorder(); 54 } 55 56 57 public Color getColor() { 58 return _color; 59 } 60 61 62 private void refreshBorder() { 63 setBorder(new FilledBorder(new Insets (_thickness, _thickness, _thickness, _thickness), new Insets (0,0,0,0), _color, Color.WHITE)); 65 setMinimumSize(new Dimension (_width, _height)); 66 } 67 68 public void setColor(Color color) { 69 this._color = color; 70 refreshBorder(); 71 } 72 73 74 75 76 public int getHeight() { 77 return _height; 78 } 79 80 81 82 83 public void setHeight(int height) { 84 this._height = height; 85 refreshBorder(); 86 } 87 88 89 90 91 public int getThickness() { 92 return _thickness; 93 } 94 95 96 97 98 public void setThickness(int thickness) { 99 this._thickness = thickness; 100 refreshBorder(); 101 } 102 103 104 105 106 public int getWidth() { 107 return _width; 108 } 109 110 111 112 113 public void setWidth(int width) { 114 this._width = width; 115 refreshBorder(); 116 } 117 118 119 120 121 public int getX() { 122 return _x; 123 } 124 125 126 127 128 public void setX(int x) { 129 this._x = x; 130 refreshBorder(); 131 } 132 133 134 135 136 public int getY() { 137 return _y; 138 } 139 140 141 142 143 public void setY(int y) { 144 this._y = y; 145 refreshBorder(); 146 } 147 148 } 149 | Popular Tags |