@Override public void windowGainedFocus (WindowEvent we) { // Once window gets focus, set initial focus if (!gotFocus) { pane.selectInitialValue(); gotFocus = true; } }
public void windowGainedFocus(WindowEvent we) { // Once window gets focus, set initial focus if (!gotFocus) { pane.selectInitialValue(); gotFocus = true; } } };
public class JEnhancedOptionPane extends JOptionPane { public static String showInputDialog(final Object message, final Object[] options) throws HeadlessException { final JOptionPane pane = new JOptionPane(message, QUESTION_MESSAGE, OK_CANCEL_OPTION, null, options, null); pane.setWantsInput(true); pane.setComponentOrientation((getRootFrame()).getComponentOrientation()); pane.setMessageType(QUESTION_MESSAGE); pane.selectInitialValue(); final String title = UIManager.getString("OptionPane.inputDialogTitle", null); final JDialog dialog = pane.createDialog(null, title); dialog.setVisible(true); dialog.dispose(); final Object value = pane.getInputValue(); return (value == UNINITIALIZED_VALUE) ? null : (String) value; } }
public class JEnhancedOptionPane extends JOptionPane { public static String showInputDialog(final Object message, final Object[] options) throws HeadlessException { final JOptionPane pane = new JOptionPane(message, QUESTION_MESSAGE, OK_CANCEL_OPTION, null, options, null); pane.setWantsInput(true); pane.setComponentOrientation((getRootFrame()).getComponentOrientation()); pane.setMessageType(QUESTION_MESSAGE); pane.selectInitialValue(); final String title = UIManager.getString("OptionPane.inputDialogTitle", null); final JDialog dialog = pane.createDialog(null, title); dialog.setVisible(true); dialog.dispose(); final Object value = pane.getInputValue(); return (value == UNINITIALIZED_VALUE) ? null : (String) value; } }
public static int showOptionDialog(Component parentComponent, Object message, String title, int optionType, int messageType, Icon icon, Object[] options, Object initialValue) throws HeadlessException { JOptionPane pane = new JOptionPane(message, messageType, optionType, icon, options, initialValue); pane.setInitialValue(initialValue); pane.setComponentOrientation(((parentComponent == null) ? getRootFrame() : parentComponent).getComponentOrientation()); int style = styleFromMessageType(messageType); JDialog dialog = pane.createDialog(parentComponent, title, style); pane.selectInitialValue(); dialog.show(); //..Result handling code }
/** * Show an non-model message dialog. */ public static void showMessageDialog(Component parent, Object message, String title, int msgtype) { final JOptionPane pane = new JOptionPane(message, msgtype); final JDialog dialog = pane.createDialog(parent, title); dialog.setModal(false); pane.selectInitialValue(); dialog.setVisible(true); // todo: find out why only called on JCC exit. dialog.addWindowListener(new WindowAdapter() { public void windowClosed(WindowEvent e) { dialog.removeWindowListener(this); dialog.dispose(); } }); }
null); pane.setComponentOrientation(JOptionPane.getRootFrame().getComponentOrientation()); pane.selectInitialValue();
optionPane.selectInitialValue(); gotFocus = true;
JDialog dialog = pane.createDialog(selectedView2dContainer, Messages.getString("KeyObjectToolBar.edit")); //$NON-NLS-1$ pane.selectInitialValue();
private String createPopupBelowCurrObject(String message, String defaultInput) { MathObject currFocused = this.getCurrentDocViewer().getFocusedObject(); PointInDocument ptInDoc = new PointInDocument( // TODO - HAX - fix this this.getCurrentDocViewer().getDoc().getPageIndex(currFocused.getParentPage()), currFocused.getxPos(), currFocused.getyPos() + currFocused.getHeight()); JOptionPane optionPane = new JOptionPane(message , JOptionPane.PLAIN_MESSAGE , JOptionPane.DEFAULT_OPTION , null, null, defaultInput); optionPane.setWantsInput(true); optionPane.setInitialSelectionValue(defaultInput); JDialog dialog = optionPane.createDialog(this, ""); Point p = getCurrentDocViewer().docPt2AbsoluteScreenPos(ptInDoc); optionPane.selectInitialValue(); dialog.setBounds((int) p.getX(), (int)p.getY() + 15, 250, 200); dialog.setVisible(true); dialog.dispose(); String result = (String) optionPane.getInputValue(); return result.equals("uninitializedValue") ? null : result; }
pane.selectInitialValue(); gotFocus = true;
pane.selectInitialValue(); sheet.addSheetListener(listener); sheet.show();
JSheet sheet = createSheet(pane, parentComponent, style); pane.selectInitialValue();