From 8c6ac67452f4f403eb8fcea311af06dcb1f43439 Mon Sep 17 00:00:00 2001 From: Phillip Date: Mon, 7 Mar 2011 03:31:48 +0000 Subject: Parameter windows will now "follow" their parent window. --- src/tesseract/newmenu/MenuItem.java | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'src/tesseract/newmenu/MenuItem.java') 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 @@ -95,6 +95,11 @@ public abstract class MenuItem extends JMenuItem implements ActionListener { private boolean useColorButton; + /** + * Parent frame + */ + private JFrame myParent; + /** * Constructor. * @param theWorld world parameter. @@ -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); } } -- cgit v1.2.3