1 | public class DimensionWrapper↵ | | 1 | public class PointWrapper↵
|
2 | {↵ | | 2 | {↵
|
3 | /** Property names for this bean. */↵ | | 3 | ↵
|
4 | public interface IPropertyNames↵ | | |
|
5 | {↵ | | |
|
6 | /** Width of <TT>Dimension</TT>. */↵ | | |
|
7 | String WIDTH = "width";↵ | | |
|
|
8 | /** Height of <TT>Dimension</TT>. */↵ | | |
|
9 | String HEIGHT = "height";↵ | | |
|
10 | }↵ | | |
|
|
11 | /** Width of <TT>Dimension</TT>. */↵ | | |
|
12 | private int _width;↵ | | |
|
|
13 | /** Height of <TT>Dimension</TT>. */↵ | | |
|
14 | private int _height;↵ | | |
|
|
15 | /**↵ | | |
|
16 | * Default ctor.↵ | | |
|
17 | */↵ | | |
|
18 | public DimensionWrapper()↵ | | |
|
19 | {↵ | | |
|
20 | this(null);↵ | | |
|
21 | }↵ | | |
|
|
22 | /**↵ | | |
|
23 | * Ctor specifying the <TT>Dimension</TT> that this object will be↵ | | |
|
24 | * wrapped around.↵ | | |
|
25 | *↵ | | |
|
26 | * @param dm The <TT>Dimension</TT> that this object will be↵ | | |
|
27 | * wrapped around.↵ | | |
|
28 | */↵ | | |
|
29 | public DimensionWrapper(Dimension dm↵ | | 4 | public interface IPropertyNames↵
|
| | | 5 | {↵
|
| | | 6 | String X = "x";↵
|
| | | 7 | String Y = "y";↵
|
| | | 8 | }↵
|
|
| | | 9 | private int _x;↵
|
| | | 10 | private int _y;↵
|
|
| | | 11 | public PointWrapper()↵
|
| | | 12 | {↵
|
| | | 13 | this(null);↵
|
| | | 14 | }↵
|
|
30 | )↵ | | 15 | public PointWrapper(Point pt)↵
|
31 | {↵ | | 16 | {↵
|
32 | super();↵ | | 17 | super();↵
|
33 | setFrom(dm);↵ | | 18 | setFrom(pt);↵
|
34 | }↵ | | 19 | }↵
|
|
35 | public int getWidth()↵ | | 20 | public int getX()↵
|
36 | {↵ | | 21 | {↵
|
37 | return _width;↵ | | 22 | return _x;↵
|
38 | }↵ | | 23 | }↵
|
|
39 | public void setWidth(int value)↵ | | 24 | public void setX(int value)↵
|
40 | {↵ | | 25 | {↵
|
41 | _width = value;↵ | | 26 | _x = value;↵
|
42 | }↵ | | 27 | }↵
|
|
43 | public int getHeight()↵ | | 28 | public int getY()↵
|
44 | {↵ | | 29 | {↵
|
45 | return _height;↵ | | 30 | return _y;↵
|
46 | }↵ | | 31 | }↵
|
|
47 | public void setHeight(int value)↵ | | 32 | public void setY(int value)↵
|
48 | {↵ | | 33 | {↵
|
49 | _height = value;↵ | | 34 | _y = value;↵
|
50 | }↵ | | 35 | }↵
|
|
51 | public Dimension createDimension()↵ | | 36 | public ↵
|
52 | {↵ | | |
|
53 | return new Dimension(_width, _height↵ | | 37 | Point createPoint()↵
|
| | | 38 | {↵
|
54 | );↵ | | 39 | return new Point(_x, _y);↵
|
55 | }↵ | | 40 | }↵
|
|
56 | public void setFrom(Dimension dm)↵ | | 41 | public void setFrom(Point pt)↵
|
57 | {↵ | | 42 | {↵
|
58 | if (dm != null)↵ | | 43 | if (pt != null)↵
|
59 | {↵ | | 44 | {↵
|
60 | _width = (int)dm.getWidth();↵ | | 45 | _↵
|
61 | _height = (int)dm.getHeight() | | 46 | x = pt.x;↵
|
| | | 47 | _y = pt.y
|