KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > xml > wsdl > ui > view > grapheditor > widget > RectangleWidget


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19 package org.netbeans.modules.xml.wsdl.ui.view.grapheditor.widget;
20
21 import java.awt.Color JavaDoc;
22 import java.awt.Dimension JavaDoc;
23 import java.awt.Insets JavaDoc;
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 /**
31  *
32  * @author skini
33  *
34  */

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 JavaDoc _color = new Color JavaDoc(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 JavaDoc getColor() {
58         return _color;
59     }
60
61
62     private void refreshBorder() {
63         //setBorder(BorderFactory.createLineBorder(_thickness, _color));
64
setBorder(new FilledBorder(new Insets JavaDoc(_thickness, _thickness, _thickness, _thickness), new Insets JavaDoc(0,0,0,0), _color, Color.WHITE));
65         setMinimumSize(new Dimension JavaDoc(_width, _height));
66     }
67
68     public void setColor(Color JavaDoc 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