Public Methods | |
| void | refill (Vector objects) |
| void | drawSquares (Graphics gg) |
| int | handleSelection (MouseEvent e) |
| int | getSelectedPoint () |
Static Public Attributes | |
| final int | BOXES = 0 |
| final int | COMPLEX = 1 |
| final int | SQ_SIDE = 6 |
| final int | SQ_HALF = 3 |
|
|
00063 {
00064 selectedObj = -1;
00065 selectedPoint = -1;
00066 this.objs.removeAllElements();
00067 createSquares(objects);
00068 drawSquares(g);
00069 }
|
|
|
00073 {
00074 g = gg;
00075 // g.setColor(Color.lightGray);
00076 g.setXORMode(Color.cyan);
00077 for (int i=0; i < objs.size(); i++) {
00078 Vector rects = (Vector)objs.elementAt(i);
00079 if (rects != null) {
00080 for (int j=0; j < rects.size(); j++) {
00081 Rectangle r = (Rectangle)rects.elementAt(j);
00082 g.drawRect(r.x - SQ_HALF,
00083 r.y - SQ_HALF, SQ_SIDE, SQ_SIDE);
00084 }
00085 }
00086 }
00087 }
|
|
|
00091 {
00092 int x = e.getX();
00093 int y = e.getY();
00094
00095 selectedObj = -1;
00096 selectedPoint = -1;
00097
00098 for (int i=0; i < objs.size(); i++) {
00099 Vector rects = (Vector)objs.elementAt(i);
00100 if (rects != null) {
00101 for (int j=0; j < rects.size(); j++) {
00102 Rectangle cur = (Rectangle)rects.elementAt(j);
00103 Rectangle r = new Rectangle(cur.x - SQ_HALF,
00104 cur.y - SQ_HALF, SQ_SIDE, SQ_SIDE);
00105 if (r.contains(x,y)) {
00106 selectedObj = i;
00107 selectedPoint = j;
00108 }
00109 }
00110 }
00111 }
00112 return selectedObj;
00113 }
|
|
|
00117 {
00118 return selectedPoint;
00119 }
|
|
|
|
|
|
|
|
|
|
|
|
|
1.2.12 written by Dimitri van Heesch,
© 1997-2001