KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > jimm > datavision > gui > PreStretchInfo


1 package jimm.datavision.gui;
2 import jimm.datavision.Section;
3
4 /**
5  * We save pre-stretch information so we have a place to hold information
6  * like original mouse click position and minimum legal mouse position.
7  *
8  * @author Jim Menard, <a HREF="mailto:jimm@io.com">jimm@io.com</a>
9  */

10 public class PreStretchInfo {
11
12 public jimm.datavision.field.Rectangle origBounds;
13 public java.awt.Point JavaDoc startMouseScreenPos;
14 public java.awt.Rectangle JavaDoc sectionBounds;
15 public java.awt.Rectangle JavaDoc screenBounds;
16
17 /**
18  * Constructor.
19  *
20  * @param fw a field widget
21  * @param mouseScreenPos the location of the mouse in screen coordinates
22  */

23 PreStretchInfo(FieldWidget fw, java.awt.Point JavaDoc mouseScreenPos) {
24     jimm.datavision.field.Rectangle b = fw.getField().getBounds();
25
26     // Copy of field's bounds
27
origBounds =
28     new jimm.datavision.field.Rectangle(b.x, b.y, b.width, b.height);
29
30     // Section's bounding rectangle
31
Section sect = fw.getSectionWidget().getSection();
32     sectionBounds = new java.awt.Rectangle JavaDoc(0, 0, (int)sect.getWidth(),
33                        (int)sect.getMinHeight());
34
35     // Field's bounds in screen coordinates
36
java.awt.Point JavaDoc screenPos = fw.getComponent().getLocationOnScreen();
37     screenBounds = new java.awt.Rectangle JavaDoc(screenPos.x, screenPos.y,
38                       (int)b.width, (int)b.height);
39
40     startMouseScreenPos = mouseScreenPos;
41 }
42 }
43
Popular Tags