From: Erik V. <ev...@us...> - 2010-01-11 23:06:47
|
Update of /cvsroot/rails/18xx/rails/ui/swing/elements In directory sfp-cvsdas-1.v30.ch3.sourceforge.com:/tmp/cvs-serv20271/rails/ui/swing/elements Modified Files: RadioButtonDialog.java Removed Files: RadioButtonDialog2.java Log Message: More dialogs made modal --- RadioButtonDialog2.java DELETED --- Index: RadioButtonDialog.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/ui/swing/elements/RadioButtonDialog.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** RadioButtonDialog.java 4 Jun 2008 19:00:39 -0000 1.5 --- RadioButtonDialog.java 11 Jan 2010 23:06:21 -0000 1.6 *************** *** 4,7 **** --- 4,8 ---- import java.awt.*; import java.awt.event.*; + import javax.swing.*; *************** *** 22,25 **** --- 23,27 ---- Dimension size, optSize; ButtonGroup group; + DialogOwner owner; String message; *************** *** 32,38 **** Logger.getLogger(RadioButtonDialog.class.getPackage().getName()); ! public RadioButtonDialog(JComponent owner, String title, String message, String[] options, int selectedOption) { ! super((Frame) null, title, true); // Modal !? this.message = message; this.options = options; --- 34,41 ---- Logger.getLogger(RadioButtonDialog.class.getPackage().getName()); ! public RadioButtonDialog(DialogOwner owner, String title, String message, String[] options, int selectedOption) { ! super((Frame) null, title, false); // Non-modal ! this.owner = owner; this.message = message; this.options = options; *************** *** 44,47 **** --- 47,51 ---- // Center on owner + /* int x = (int) owner.getLocationOnScreen().getX() *************** *** 50,53 **** --- 54,60 ---- (int) owner.getLocationOnScreen().getY() + (owner.getHeight() - getHeight()) / 2; + */ + int x = 400; + int y = 400; setLocation(x, y); *************** *** 66,73 **** buttonPane.add(okButton); ! cancelButton = new JButton(LocalText.getText("Cancel")); ! cancelButton.setMnemonic(KeyEvent.VK_C); ! cancelButton.addActionListener(this); ! buttonPane.add(cancelButton); choiceButtons = new JRadioButton[numOptions]; --- 73,83 ---- buttonPane.add(okButton); ! if (selectedOption < 0) { ! // If an option has been preselected, selection is mandatory. ! cancelButton = new JButton(LocalText.getText("Cancel")); ! cancelButton.setMnemonic(KeyEvent.VK_C); ! cancelButton.addActionListener(this); ! buttonPane.add(cancelButton); ! } choiceButtons = new JRadioButton[numOptions]; *************** *** 119,130 **** } } else if (arg0.getSource().equals(cancelButton)) { ! chosenOption = -1; } this.setVisible(false); this.dispose(); ! } ! public int getSelectedOption() { return chosenOption; } --- 129,140 ---- } } else if (arg0.getSource().equals(cancelButton)) { ! return; } this.setVisible(false); this.dispose(); ! owner.dialogActionPerformed(); } ! public synchronized int getSelectedOption() { return chosenOption; } |