diff options
author | Phillip <pacardon@u.washington.edu> | 2011-03-07 03:31:48 +0000 |
---|---|---|
committer | Phillip <pacardon@u.washington.edu> | 2011-03-07 03:31:48 +0000 |
commit | 8c6ac67452f4f403eb8fcea311af06dcb1f43439 (patch) | |
tree | bff11b416f287363f924372591b8e25a37811a61 /src/tesseract/newmenu/MenuItem.java | |
parent | 58c224e1ef76d0c213464617fb464f3cc09722f1 (diff) |
Parameter windows will now "follow" their parent window.
Diffstat (limited to 'src/tesseract/newmenu/MenuItem.java')
-rw-r--r-- | src/tesseract/newmenu/MenuItem.java | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/src/tesseract/newmenu/MenuItem.java b/src/tesseract/newmenu/MenuItem.java index 6507b52..67f729a 100644 --- a/src/tesseract/newmenu/MenuItem.java +++ b/src/tesseract/newmenu/MenuItem.java @@ -96,6 +96,11 @@ public abstract class MenuItem extends JMenuItem implements ActionListener { private boolean useColorButton;
/**
+ * Parent frame
+ */
+ private JFrame myParent;
+
+ /**
* Constructor.
* @param theWorld world parameter.
* @param theLabel for menu item.
@@ -116,6 +121,7 @@ public abstract class MenuItem extends JMenuItem implements ActionListener { myParamFrame.setLayout(new BorderLayout());
myColorButton = new JButton("Color");
myColor = Color.RED;
+ myParent = new JFrame();
}
/**
@@ -263,10 +269,18 @@ public abstract class MenuItem extends JMenuItem implements ActionListener { }
/**
- * Set Parent
+ * Set Parent.
* @param theParent frame.
*/
- public void setParent (final JFrame theParent) {
+ public void setParent(final JFrame theParent) {
myParamFrame.setLocationRelativeTo(theParent);
+ myParent = theParent;
+ }
+
+ /**
+ * Set Parent.
+ */
+ public void setParent() {
+ myParamFrame.setLocationRelativeTo(myParent);
}
}
|