Java Code Examples for javax.swing.JOptionPane#PLAIN_MESSAGE
The following examples show how to use
javax.swing.JOptionPane#PLAIN_MESSAGE .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: UserMessageHelper.java From openAGV with Apache License 2.0 | 6 votes |
private int translateType(Type type) { int jOptionType; switch (type) { case ERROR: jOptionType = JOptionPane.ERROR_MESSAGE; break; case INFO: jOptionType = JOptionPane.INFORMATION_MESSAGE; break; case QUESTION: jOptionType = JOptionPane.YES_NO_OPTION; break; default: jOptionType = JOptionPane.PLAIN_MESSAGE; } return jOptionType; }
Example 2
Source File: MessageDialogs.java From FancyBing with GNU General Public License v3.0 | 6 votes |
public void showInfo(String disableKey, Component frame, String mainMessage, String optionalMessage, boolean isCritical) { if (checkDisabled(disableKey)) return; int type; if (isCritical) type = JOptionPane.INFORMATION_MESSAGE; else type = JOptionPane.PLAIN_MESSAGE; Object[] options = { i18n("LB_CLOSE") }; Object defaultOption = options[0]; show(disableKey, frame, "", mainMessage, optionalMessage, type, JOptionPane.DEFAULT_OPTION, options, defaultOption, -1); }
Example 3
Source File: MessageDialogs.java From FancyBing with GNU General Public License v3.0 | 6 votes |
public void showWarning(String disableKey, Component parent, String mainMessage, String optionalMessage, boolean isCritical) { if (checkDisabled(disableKey)) return; int type; if (isCritical) type = JOptionPane.WARNING_MESSAGE; else type = JOptionPane.PLAIN_MESSAGE; Object[] options = { i18n("LB_CLOSE") }; Object defaultOption = options[0]; show(disableKey, parent, "", mainMessage, optionalMessage, type, JOptionPane.DEFAULT_OPTION, options, defaultOption, -1); }
Example 4
Source File: LoadingWindow.java From jmg with GNU General Public License v2.0 | 6 votes |
public static void showLoadingWindow() { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Exception e) { } JOptionPane pane = new JOptionPane("Загрузка. Пожалуйста, подождите...", JOptionPane.PLAIN_MESSAGE, JOptionPane.DEFAULT_OPTION, null, new Object[]{}, null); LOADING_PANE = new JDialog(); LOADING_PANE.setModal(false); LOADING_PANE.setContentPane(pane); LOADING_PANE.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); LOADING_PANE.setLocation(100, 200); LOADING_PANE.pack(); LOADING_PANE.setVisible(true); }
Example 5
Source File: Interrupt.java From FancyBing with GNU General Public License v3.0 | 5 votes |
/** Interrupt command. Confirm interrupt by user and send interrupt comment line if supported by the program, otherwise kill the program. @return true if interrupt comment line was sent. */ public boolean run(Component parent, GuiGtpClient gtp, MessageDialogs messageDialogs) { if (! gtp.isInterruptSupported()) { Object[] options = { i18n("LB_INTERRUPT_TERMINATE"), i18n("LB_CANCEL") }; Object message = i18n("MSG_INTERRUPT_NO_SUPPORT"); int type = JOptionPane.WARNING_MESSAGE; if (Platform.isMac()) type = JOptionPane.PLAIN_MESSAGE; int n = JOptionPane.showOptionDialog(parent, message, i18n("TIT_QUESTION"), JOptionPane.YES_NO_OPTION, type, null, options, options[1]); if (n == 0) gtp.destroyGtp(); return false; } if (! gtp.isCommandInProgress()) return false; try { gtp.sendInterrupt(); } catch (GtpError e) { messageDialogs.showError(parent, i18n("MSG_INTERRUPT_FAILED"), e); return false; } return true; }
Example 6
Source File: MessageDialogs.java From FancyBing with GNU General Public License v3.0 | 5 votes |
public void showError(Component frame, String mainMessage, String optionalMessage, boolean isCritical) { int type; if (isCritical) type = JOptionPane.ERROR_MESSAGE; else type = JOptionPane.PLAIN_MESSAGE; Object[] options = { i18n("LB_CLOSE") }; Object defaultOption = options[0]; show(null, frame, "", mainMessage, optionalMessage, type, JOptionPane.DEFAULT_OPTION, options, defaultOption, -1); }
Example 7
Source File: MessageDialogs.java From FancyBing with GNU General Public License v3.0 | 5 votes |
/** Show warning message to confirm destructive actions. @return true, if destructive was chosen; false if cancel was chosen. */ public boolean showQuestion(String disableKey, Component parent, String mainMessage, String optionalMessage, String affirmativeOption, String cancelOption, boolean isCritical) { if (checkDisabled(disableKey)) return true; Object[] options = new Object[2]; if (Platform.isMac()) { options[0] = cancelOption; options[1] = affirmativeOption; } else { options[0] = affirmativeOption; options[1] = cancelOption; } Object defaultOption = affirmativeOption; int type; if (isCritical) // No reason to show a warning icon for confirmation dialogs // of frequent actions type = JOptionPane.QUESTION_MESSAGE; else type = JOptionPane.PLAIN_MESSAGE; Object result = show(disableKey, parent, "", mainMessage, optionalMessage, type, JOptionPane.YES_NO_OPTION, options, defaultOption, -1); return (result == affirmativeOption); }
Example 8
Source File: MessageDialogs.java From FancyBing with GNU General Public License v3.0 | 5 votes |
/** Show warning message to confirm destructive actions. @return true, if destructive was chosen; false if cancel was chosen. */ public boolean showWarningQuestion(String disableKey, Component parent, String mainMessage, String optionalMessage, String destructiveOption, String nonDestructiveOption, boolean isCritical) { if (checkDisabled(disableKey)) return true; Object[] options = new Object[2]; if (Platform.isMac()) { options[0] = nonDestructiveOption; options[1] = destructiveOption; } else { options[0] = destructiveOption; options[1] = nonDestructiveOption; } Object defaultOption = nonDestructiveOption; int type; if (isCritical) type = JOptionPane.WARNING_MESSAGE; else type = JOptionPane.PLAIN_MESSAGE; Object result = show(disableKey, parent, "", mainMessage, optionalMessage, type, JOptionPane.YES_NO_OPTION, options, defaultOption, -1); return (result == destructiveOption); }
Example 9
Source File: OurDialog.java From org.alloytools.alloy with Apache License 2.0 | 5 votes |
/** * Popup the given informative message, then ask the user to click Close to * close it. */ public static void showmsg(String title, Object... msg) { JButton dismiss = new JButton(Util.onMac() ? "Dismiss" : "Close"); Object[] objs = new Object[msg.length + 1]; System.arraycopy(msg, 0, objs, 0, msg.length); objs[objs.length - 1] = OurUtil.makeH(null, dismiss, null); JOptionPane about = new JOptionPane(objs, JOptionPane.PLAIN_MESSAGE, JOptionPane.DEFAULT_OPTION, null, new Object[] {}); JDialog dialog = about.createDialog(null, title); dismiss.addActionListener(Runner.createDispose(dialog)); dialog.setAlwaysOnTop(true); dialog.setVisible(true); dialog.dispose(); }
Example 10
Source File: ExportDialog.java From FCMFrame with Apache License 2.0 | 5 votes |
/** * Creates a new instance of ExportDialog. * * @param creator * The "creator" to be written into the header of the file (may * be null) * @param addAllExportFileTypes * If true registers all the standard export filetypes */ public ExportDialog(String creator, boolean addAllExportFileTypes) { super(null, JOptionPane.PLAIN_MESSAGE, JOptionPane.OK_CANCEL_OPTION); this.creator = creator; try { baseDir = System.getProperty("user.home"); } catch (SecurityException x) { trusted = false; } ButtonListener bl = new ButtonListener(); JPanel panel = new JPanel(new TableLayout()); if (trusted) { panel.add("* * [5 5 5 5] w", file); panel.add("* * * 1 [5 5 5 5] wh", browse); } type = new JComboBox(list); type.setMaximumRowCount(16); // rather than 8 panel.add("* * 1 1 [5 5 5 5] w", type); panel.add("* * * 1 [5 5 5 5] wh", advanced); browse.addActionListener(bl); advanced.addActionListener(bl); type.setRenderer(new SaveAsRenderer()); type.addActionListener(bl); setMessage(panel); if (addAllExportFileTypes) addAllExportFileTypes(); }
Example 11
Source File: StartupDialog.java From visualvm with GNU General Public License v2.0 | 5 votes |
private static int styleFromMessageType(int messageType) { switch (messageType) { case JOptionPane.ERROR_MESSAGE: return JRootPane.ERROR_DIALOG; case JOptionPane.QUESTION_MESSAGE: return JRootPane.QUESTION_DIALOG; case JOptionPane.WARNING_MESSAGE: return JRootPane.WARNING_DIALOG; case JOptionPane.INFORMATION_MESSAGE: return JRootPane.INFORMATION_DIALOG; case JOptionPane.PLAIN_MESSAGE: default: return JRootPane.PLAIN_DIALOG; } }
Example 12
Source File: InputTextAreaDialog.java From Spark with Apache License 2.0 | 4 votes |
/** * Prompt and return input. * * @param title the title of the dialog. * @param description the dialog description. * @param icon the icon to use. * @param parent the parent to use. * @return the user input. */ public String getInput(String title, String description, Icon icon, Component parent) { textArea = new JTextArea(); textArea.setLineWrap(true); TitlePanel titlePanel = new TitlePanel(title, description, icon, true); // Construct main panel w/ layout. final JPanel mainPanel = new JPanel(); mainPanel.setLayout(new BorderLayout()); mainPanel.add(titlePanel, BorderLayout.NORTH); // The user should only be able to close this dialog. final Object[] options = {Res.getString("ok"), Res.getString("cancel")}; optionPane = new JOptionPane(new JScrollPane(textArea), JOptionPane.PLAIN_MESSAGE, JOptionPane.OK_CANCEL_OPTION, null, options, options[0]); mainPanel.add(optionPane, BorderLayout.CENTER); // Let's make sure that the dialog is modal. Cannot risk people // losing this dialog. JOptionPane p = new JOptionPane(); dialog = p.createDialog(parent, title); dialog.setModal(true); dialog.pack(); dialog.setSize(width, height); dialog.setContentPane(mainPanel); dialog.setLocationRelativeTo(parent); optionPane.addPropertyChangeListener(this); // Add Key Listener to Send Field textArea.addKeyListener(new KeyAdapter() { @Override public void keyPressed(KeyEvent e) { if (e.getKeyChar() == KeyEvent.VK_TAB) { optionPane.requestFocus(); } else if (e.getKeyChar() == KeyEvent.VK_ESCAPE) { dialog.dispose(); } } }); textArea.requestFocus(); dialog.setVisible(true); return stringValue; }
Example 13
Source File: IdeOptions.java From CQL with GNU Affero General Public License v3.0 | 4 votes |
public void showOptions0() { IdeOptions o = this; // new IdeOptions(IdeOptions.theCurrentOptions); JPanel p1 = new JPanel(new GridLayout(1, 1)); p1.add(new JScrollPane(general())); JPanel p2 = new JPanel(new GridLayout(1, 1)); p2.add(new JScrollPane(onlyColors())); JPanel p3 = new JPanel(new GridLayout(1, 1)); p3.add(new JScrollPane(outline())); JTabbedPane jtb = new JTabbedPane(); jtb.add("General", p1); jtb.add("Colors", p2); jtb.add("Outline", p3); CodeTextPanel cc = new CodeTextPanel("", AqlOptions.getMsg()); jtb.addTab("CQL", cc); jtb.setSelectedIndex(selected_tab); JPanel oo = new JPanel(new GridLayout(1, 1)); oo.add(jtb); // oo.setPreferredSize(theD); // outline at top otherwise weird sizing collapse on screen JOptionPane pane = new JOptionPane(oo, JOptionPane.PLAIN_MESSAGE, JOptionPane.OK_CANCEL_OPTION, null, new String[] { "OK", "Cancel", "Reset", "Save", "Load", "Delete" }, "OK"); // pane.setPreferredSize(theD); JDialog dialog = pane.createDialog(null, "Options"); dialog.setModal(false); dialog.setResizable(true); dialog.addWindowListener(new WindowAdapter() { @Override public void windowDeactivated(WindowEvent e) { Object ret = pane.getValue(); selected_tab = jtb.getSelectedIndex(); if (ret == "OK") { theCurrentOptions = o; notifyListenersOfChange(); } else if (ret == "Reset") { new IdeOptions().showOptions0(); } else if (ret == "Save") { // save save(o); o.showOptions0(); } else if (ret == "Load") { // load load().showOptions0(); } else if (ret == "Delete") { delete(); o.showOptions0(); } } }); dialog.setPreferredSize(theD); dialog.pack(); dialog.setLocationRelativeTo(null); dialog.setVisible(true); }
Example 14
Source File: PasswordDialog.java From Spark with Apache License 2.0 | 4 votes |
/** * Prompt and return input. * * @param title the title of the dialog. * @param description the dialog description. * @param icon the icon to use. * @param parent the parent to use. * @return the user input. */ public String getPassword(String title, String description, Icon icon, Component parent) { passwordField = new JPasswordField(); passwordField.setText(password); TitlePanel titlePanel = new TitlePanel(title, description, icon, true); // Construct main panel w/ layout. final JPanel mainPanel = new JPanel(); mainPanel.setLayout(new BorderLayout()); mainPanel.add(titlePanel, BorderLayout.NORTH); final JPanel passwordPanel = new JPanel(new GridBagLayout()); JLabel passwordLabel = new JLabel(Res.getString("label.enter.password") + ":"); passwordPanel.add(passwordLabel, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); passwordPanel.add(passwordField, new GridBagConstraints(1, 0, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5), 0, 0)); //user should be able to close this dialog (with an option to save room's password) passwordPanel.add(_savePasswordBox, new GridBagConstraints(1, 1, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5), 0, 0)); ResourceUtils.resButton(_savePasswordBox, Res.getString("checkbox.save.password")); final Object[] options = {Res.getString("ok"), Res.getString("cancel") , }; optionPane = new JOptionPane(passwordPanel, JOptionPane.PLAIN_MESSAGE, JOptionPane.OK_CANCEL_OPTION, null, options, options[0]); mainPanel.add(optionPane, BorderLayout.CENTER); // Lets make sure that the dialog is modal. Cannot risk people // losing this dialog. JOptionPane p = new JOptionPane(); dialog = p.createDialog(parent, title); dialog.setModal(true); dialog.pack(); dialog.setSize(width, height); dialog.setContentPane(mainPanel); dialog.setLocationRelativeTo(parent); optionPane.addPropertyChangeListener(this); // Add Key Listener to Send Field passwordField.addKeyListener(new KeyAdapter() { @Override public void keyPressed(KeyEvent e) { if (e.getKeyChar() == KeyEvent.VK_TAB) { optionPane.requestFocus(); } else if (e.getKeyChar() == KeyEvent.VK_ESCAPE) { dialog.dispose(); } } }); passwordField.requestFocus(); dialog.setVisible(true); return stringValue; }
Example 15
Source File: InputDialog.java From Spark with Apache License 2.0 | 4 votes |
/** * Prompt and return input. * * @param title the title of the dialog. * @param description the dialog description. * @param icon the icon to use. * @param parent the parent to use. * @return the user input. */ public String getInput(String title, String description, Icon icon, Component parent) { textArea = new JTextArea(); textArea.setLineWrap(true); TitlePanel titlePanel = new TitlePanel(title, description, icon, true); // Construct main panel w/ layout. final JPanel mainPanel = new JPanel(); mainPanel.setLayout(new BorderLayout()); mainPanel.add(titlePanel, BorderLayout.NORTH); // The user should only be able to close this dialog. final Object[] options = {Res.getString("ok"), Res.getString("cancel")}; optionPane = new JOptionPane(new JScrollPane(textArea), JOptionPane.PLAIN_MESSAGE, JOptionPane.OK_CANCEL_OPTION, null, options, options[0]); mainPanel.add(optionPane, BorderLayout.CENTER); // Lets make sure that the dialog is modal. Cannot risk people // losing this dialog. JOptionPane p = new JOptionPane(); dialog = p.createDialog(parent, title); dialog.setModal(true); dialog.pack(); dialog.setSize(width, height); dialog.setContentPane(mainPanel); dialog.setLocationRelativeTo(parent); optionPane.addPropertyChangeListener(this); // Add Key Listener to Send Field textArea.addKeyListener(new KeyAdapter() { @Override public void keyPressed(KeyEvent e) { if (e.getKeyChar() == KeyEvent.VK_TAB) { optionPane.requestFocus(); } else if (e.getKeyChar() == KeyEvent.VK_ESCAPE) { dialog.dispose(); } } }); textArea.requestFocus(); textArea.setWrapStyleWord(true); dialog.setVisible(true); return stringValue; }
Example 16
Source File: NarrowOptionPane.java From jclic with GNU General Public License v2.0 | 4 votes |
public NarrowOptionPane(int maxCharactersPerLineCount, Object message) { this(maxCharactersPerLineCount, message, JOptionPane.PLAIN_MESSAGE); }
Example 17
Source File: UploadPropertiesDialog.java From zap-extensions with Apache License 2.0 | 4 votes |
public void openProperties(final UploadActionListener uploader){ JPanel message = new JPanel(new GridBagLayout()); serverUrl = labelTextField(Constant.messages.getString("codedx.settings.serverurl") + " ", message, CodeDxProperties.getInstance().getServerUrl(), 30); apiKey = labelTextField(Constant.messages.getString("codedx.settings.apikey") + " ", message, CodeDxProperties.getInstance().getApiKey(), 30); projectBox = createProjectComboBox(message); timeout = labelTextField(Constant.messages.getString("codedx.setting.timeout") + " ", message, CodeDxProperties.getInstance().getTimeout(), 5); final JOptionPane pane = new JOptionPane(message, JOptionPane.PLAIN_MESSAGE, JOptionPane.OK_CANCEL_OPTION, null, DIALOG_BUTTONS, null); dialog = pane.createDialog(Constant.messages.getString("codedx.settings.title")); Thread popupThread = new Thread(){ @Override public void run(){ dialog.setVisible(true); if (DIALOG_BUTTONS[0].equals(pane.getValue())) { String timeoutValue = timeout.getText(); if (!isStringNumber(timeoutValue)) { timeoutValue = CodeDxProperties.DEFAULT_TIMEOUT_STRING; error(Constant.messages.getString("codedx.error.timeout")); } CodeDxProperties.getInstance().setProperties(serverUrl.getText(), apiKey.getText(), getProject().getValue(), timeoutValue); uploader.generateAndUploadReport(); } } }; Thread updateThread = new Thread(){ @Override public void run(){ if(!"".equals(serverUrl.getText()) && !"".equals(apiKey.getText())){ updateProjects(true); String previousId = CodeDxProperties.getInstance().getSelectedId(); for(NameValuePair p: projectArr){ if(previousId.equals(p.getValue())) projectBox.setSelectedItem(p); } } } }; popupThread.start(); updateThread.start(); }
Example 18
Source File: BEInternalFrameTitlePane.java From beautyeye with Apache License 2.0 | 4 votes |
/** * Updates any state dependant upon the JInternalFrame being shown in * a <code>JOptionPane</code>. */ private void updateOptionPaneState() { int type = -2; boolean closable = wasClosable; Object obj = frame.getClientProperty("JInternalFrame.messageType"); if (obj == null) { // Don't change the closable state unless in an JOptionPane. return; } if (obj instanceof Integer) { type = ((Integer) obj).intValue(); } switch (type) { case JOptionPane.ERROR_MESSAGE: selectedBackgroundKey = "OptionPane.errorDialog.titlePane.background"; selectedForegroundKey = "OptionPane.errorDialog.titlePane.foreground"; selectedShadowKey = "OptionPane.errorDialog.titlePane.shadow"; closable = false; break; case JOptionPane.QUESTION_MESSAGE: selectedBackgroundKey = "OptionPane.questionDialog.titlePane.background"; selectedForegroundKey = "OptionPane.questionDialog.titlePane.foreground"; selectedShadowKey = "OptionPane.questionDialog.titlePane.shadow"; closable = false; break; case JOptionPane.WARNING_MESSAGE: selectedBackgroundKey = "OptionPane.warningDialog.titlePane.background"; selectedForegroundKey = "OptionPane.warningDialog.titlePane.foreground"; selectedShadowKey = "OptionPane.warningDialog.titlePane.shadow"; closable = false; break; case JOptionPane.INFORMATION_MESSAGE: case JOptionPane.PLAIN_MESSAGE: selectedBackgroundKey = selectedForegroundKey = selectedShadowKey = null; closable = false; break; default: selectedBackgroundKey = selectedForegroundKey = selectedShadowKey = null; break; } if (closable != frame.isClosable()) { frame.setClosable(closable); } }
Example 19
Source File: VCardEditor.java From Spark with Apache License 2.0 | 4 votes |
/** * Displays a users profile. * * @param jid * the jid of the user. * @param vcard * the users vcard. * @param parent * the parent component, used for location handling. */ public void displayProfile(final BareJid jid, VCard vcard, JComponent parent) { VCardViewer viewer = new VCardViewer(jid); final JFrame dlg = new JFrame(Res.getString("title.view.profile.for", jid)); avatarLabel = new JLabel(); avatarLabel.setHorizontalAlignment(JButton.RIGHT); avatarLabel.setBorder(BorderFactory.createBevelBorder(0, Color.white, Color.lightGray)); // The user should only be able to close this dialog. Object[] options = { Res.getString("button.view.profile"), Res.getString("close") }; final JOptionPane pane = new JOptionPane(viewer, JOptionPane.PLAIN_MESSAGE, JOptionPane.OK_CANCEL_OPTION, null, options, options[0]); // mainPanel.add(pane, new GridBagConstraints(0, 1, 1, 1, 1.0, 1.0, // GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 5, // 5, 5), 0, 0)); dlg.setIconImage(SparkRes.getImageIcon(SparkRes.PROFILE_IMAGE_16x16) .getImage()); dlg.pack(); dlg.setSize(350, 250); dlg.setResizable(true); dlg.setContentPane(pane); dlg.setLocationRelativeTo(parent); PropertyChangeListener changeListener = new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent e) { if (pane.getValue() instanceof Integer) { pane.removePropertyChangeListener(this); dlg.dispose(); return; } String value = (String) pane.getValue(); if (Res.getString("close").equals(value)) { pane.removePropertyChangeListener(this); dlg.dispose(); } else if (Res.getString("button.view.profile").equals(value)) { pane.setValue(JOptionPane.UNINITIALIZED_VALUE); SparkManager.getVCardManager().viewFullProfile(jid, pane); } } }; pane.addPropertyChangeListener(changeListener); dlg.addKeyListener(new KeyAdapter() { @Override public void keyPressed(KeyEvent keyEvent) { if (keyEvent.getKeyChar() == KeyEvent.VK_ESCAPE) { dlg.dispose(); } } }); dlg.setVisible(true); dlg.toFront(); dlg.requestFocus(); }
Example 20
Source File: BookmarkEditor.java From FancyBing with GNU General Public License v3.0 | 4 votes |
public Bookmark editItem(Component parent, String title, Bookmark bookmark, boolean selectName, MessageDialogs messageDialogs) { JPanel panel = new JPanel(new BorderLayout(GuiUtil.SMALL_PAD, 0)); m_panelLeft = new JPanel(new GridLayout(0, 1, 0, GuiUtil.PAD)); panel.add(m_panelLeft, BorderLayout.WEST); m_panelRight = new JPanel(new GridLayout(0, 1, 0, GuiUtil.PAD)); panel.add(m_panelRight, BorderLayout.CENTER); m_name = createEntry("LB_BOOKMARKEDITOR_NAME", 25, bookmark.m_name); String file = ""; if (bookmark.m_file != null) file = bookmark.m_file.toString(); m_file = createEntry("LB_BOOKMARKEDITOR_FILE", 25, file); String move = ""; if (bookmark.m_move > 0) move = Integer.toString(bookmark.m_move); m_move = createEntry("LB_BOOKMARKEDITOR_MOVE", 10, move); m_variation = createEntry("LB_BOOKMARKEDITOR_VARIATION", 10, bookmark.m_variation); JOptionPane optionPane = new JOptionPane(panel, JOptionPane.PLAIN_MESSAGE, JOptionPane.OK_CANCEL_OPTION); JDialog dialog = optionPane.createDialog(parent, title); boolean done = false; while (! done) { if (selectName) m_name.selectAll(); dialog.addWindowListener(new WindowAdapter() { public void windowActivated(WindowEvent e) { m_name.requestFocusInWindow(); } }); dialog.setVisible(true); Object value = optionPane.getValue(); if (! (value instanceof Integer) || ((Integer)value).intValue() != JOptionPane.OK_OPTION) return null; done = validate(parent, messageDialogs); } String newName = m_name.getText().trim(); File newFile = new File(m_file.getText()); int newMove = getMove(); String newVariation = m_variation.getText().trim(); Bookmark newBookmark = new Bookmark(newName, newFile, newMove, newVariation); dialog.dispose(); return newBookmark; }