Dialogs now open up relative to the parent window.

This commit is contained in:
Fabian Becker 2014-10-19 20:01:01 +02:00
parent 9ce4f3e130
commit d5f1a9eeee
6 changed files with 8 additions and 14 deletions

View File

@ -24,7 +24,7 @@ public class PropertyDialog extends JDialog {
/** /**
* *
*/ */
public PropertyDialog(Window parent, PropertyEditor editor, String title, int x, int y) { public PropertyDialog(Window parent, PropertyEditor editor, String title) {
super(parent, title, ModalityType.APPLICATION_MODAL); super(parent, title, ModalityType.APPLICATION_MODAL);
setTitle(getFrameNameFromEditor(editor)); setTitle(getFrameNameFromEditor(editor));
BasicResourceLoader loader = BasicResourceLoader.instance(); BasicResourceLoader loader = BasicResourceLoader.instance();
@ -36,7 +36,7 @@ public class PropertyDialog extends JDialog {
add(editorComponent, BorderLayout.CENTER); add(editorComponent, BorderLayout.CENTER);
pack(); pack();
setLocation(x, y); setLocationRelativeTo(parent);
} }
protected static String getFrameNameFromEditor(PropertyEditor editor) { protected static String getFrameNameFromEditor(PropertyEditor editor) {

View File

@ -34,10 +34,10 @@ public class PropertyPanel extends JPanel {
add(textLabel, gbConstraints); add(textLabel, gbConstraints);
} }
public void showDialog(int initX, int initY) { public void showDialog() {
Window parent = (Window)this.getRootPane().getParent(); Window parent = (Window)this.getRootPane().getParent();
if (propertyDialog == null) { if (propertyDialog == null) {
propertyDialog = new PropertyDialog(parent, propertyEditor, EVAHELP.cutClassName(propertyEditor.getClass().getName()), initX, initY); propertyDialog = new PropertyDialog(parent, propertyEditor, EVAHELP.cutClassName(propertyEditor.getClass().getName()));
propertyDialog.setPreferredSize(new Dimension(500, 300)); propertyDialog.setPreferredSize(new Dimension(500, 300));
propertyDialog.setModal(true); propertyDialog.setModal(true);
propertyDialog.setVisible(true); propertyDialog.setVisible(true);

View File

@ -1075,7 +1075,7 @@ class PropertyCellEditor extends AbstractCellEditor implements TableCellEditor {
dialogButton.addActionListener(new ActionListener() { dialogButton.addActionListener(new ActionListener() {
@Override @Override
public void actionPerformed(final ActionEvent event) { public void actionPerformed(final ActionEvent event) {
((PropertyPanel) value).showDialog(0, 0); ((PropertyPanel) value).showDialog();
fireEditingStopped(); fireEditingStopped();
} }
}); });

View File

@ -28,7 +28,7 @@ public class BigStringEditor implements PropertyEditor {
isFinished = false; isFinished = false;
BigStringEditor editor = new BigStringEditor(); BigStringEditor editor = new BigStringEditor();
PropertyDialog dialog = new PropertyDialog(null, editor, file, 50, 50); PropertyDialog dialog = new PropertyDialog(null, editor, file);
while (isFinished == false) { while (isFinished == false) {
try { try {

View File

@ -237,7 +237,7 @@ public class GenericArrayEditor extends JPanel implements PropertyEditor {
Object item = dlm.getElementAt(index); Object item = dlm.getElementAt(index);
list.ensureIndexIsVisible(index); list.ensureIndexIsVisible(index);
propPanel.getEditor().setValue(item); propPanel.getEditor().setValue(item);
propPanel.showDialog(e.getXOnScreen(), e.getYOnScreen()); propPanel.showDialog();
propPanel = null; propPanel = null;
} }
} }

View File

@ -17,13 +17,7 @@ import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;
/** /**
* The class gives access to all EP parameters for the EvA *
* top level GUI.
* Created by IntelliJ IDEA.
* User: streiche
* Date: 27.10.2004
* Time: 13:49:09
* To change this template use File | Settings | File Templates.
*/ */
public class EPParameters extends AbstractOptimizationParameters implements InterfaceOptimizationParameters, Serializable { public class EPParameters extends AbstractOptimizationParameters implements InterfaceOptimizationParameters, Serializable {