01: package jimm.datavision.gui.cmd;
02:
03: import jimm.datavision.field.Rectangle;
04: import jimm.datavision.field.Field;
05: import jimm.util.I18N;
06:
07: /**
08: * A command for changing a field's bounds.
09: *
10: * @author Jim Menard, <a href="mailto:jimm@io.com">jimm@io.com</a>
11: */
12: public class BoundsCommand extends CommandAdapter {
13:
14: protected Field field;
15: protected Rectangle origBounds;
16: protected Rectangle newBounds;
17:
18: public BoundsCommand(Field f, Rectangle bounds) {
19: super (I18N.get("BoundsCommand.name"));
20: field = f;
21: origBounds = new Rectangle(field.getBounds());
22: newBounds = bounds;
23: }
24:
25: public void perform() {
26: field.getBounds().setBounds(newBounds);
27: }
28:
29: public void undo() {
30: field.getBounds().setBounds(origBounds);
31: }
32:
33: }
|