Java Code Examples for javax.swing.JOptionPane#createDialog()
The following examples show how to use
javax.swing.JOptionPane#createDialog() .
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: ConfirmTabCloseDialog.java From tn5250j with GNU General Public License v2.0 | 6 votes |
private void initLayout() { Object[] messages = new Object[1]; { JPanel srp = new JPanel(); srp.setLayout(new BorderLayout()); JLabel jl = new JLabel("Are you sure you want to close this tab?"); srp.add(jl, BorderLayout.NORTH); messages[0] = srp; } pane = new JOptionPane(messages, // the dialog message array JOptionPane.QUESTION_MESSAGE, // message type JOptionPane.DEFAULT_OPTION, // option type null, // optional icon, use null to use the default icon OPTIONS, // options string array, will be made into buttons OPTIONS[0]); dialog = pane.createDialog(parent, LangTool.getString("sa.confirmTabClose")); }
Example 2
Source File: OurDialog.java From org.alloytools.alloy with Apache License 2.0 | 6 votes |
/** * Helper method for constructing an always-on-top modal dialog. */ private static Object show(JFrame parent, String title, int type, Object message, Object[] options, Object initialOption) { if (options == null) { options = new Object[] { "Ok" }; initialOption = "Ok"; } JOptionPane p = new JOptionPane(message, type, JOptionPane.DEFAULT_OPTION, null, options, initialOption); p.setInitialValue(initialOption); JDialog d = p.createDialog(parent, title); p.selectInitialValue(); d.setAlwaysOnTop(true); d.setVisible(true); d.dispose(); return p.getValue(); }
Example 3
Source File: JOptionInput.java From jeveassets with GNU General Public License v2.0 | 6 votes |
private static Object internalInputDialog(Component parentComponent, Object message, String title, int messageType, Icon icon, Object[] selectionValues, Object initialSelectionValue) { JOptionPane pane = new JOptionPane(message, messageType, OK_CANCEL_OPTION, icon, null, null); pane.setWantsInput(true); pane.setSelectionValues(selectionValues); pane.setInitialSelectionValue(initialSelectionValue); pane.setComponentOrientation(((parentComponent == null) ? getRootFrame() : parentComponent).getComponentOrientation()); TextManager.installAll(pane); JDialog dialog = pane.createDialog(parentComponent, title); pane.selectInitialValue(); dialog.setVisible(true); dialog.dispose(); Object value = pane.getInputValue(); if (value == UNINITIALIZED_VALUE) { return null; } return value; }
Example 4
Source File: BytecodeViewer.java From bytecode-viewer with GNU General Public License v3.0 | 5 votes |
/** * Resets the workspace with optional user input required * * @param ask if should require user input or not */ public static void resetWorkSpace(boolean ask) { if(ask) { JOptionPane pane = new JOptionPane( "Are you sure you want to reset the workspace?\n\rIt will also reset your file navigator and search."); Object[] options = new String[]{"Yes", "No"}; pane.setOptions(options); JDialog dialog = pane.createDialog(viewer, "Bytecode Viewer - Reset Workspace"); dialog.setVisible(true); Object obj = pane.getValue(); int result = -1; for (int k = 0; k < options.length; k++) if (options[k].equals(obj)) result = k; if (result != 0) return; } files.clear(); LazyNameUtil.reset(); MainViewerGUI.getComponent(FileNavigationPane.class).resetWorkspace(); MainViewerGUI.getComponent(WorkPane.class).resetWorkspace(); MainViewerGUI.getComponent(SearchingPane.class).resetWorkspace(); the.bytecode.club.bytecodeviewer.api.BytecodeViewer.getClassNodeLoader().clear(); }
Example 5
Source File: SystemRequestDialog.java From tn5250j with GNU General Public License v2.0 | 5 votes |
private void initLayout() { JPanel srp = new JPanel(); srp.setLayout(new BorderLayout()); JLabel jl = new JLabel("Enter alternate job"); text = new JTextField(); srp.add(jl, BorderLayout.NORTH); srp.add(text, BorderLayout.CENTER); Object[] message = new Object[1]; message[0] = srp; pane = new JOptionPane(message, // the dialog message array JOptionPane.QUESTION_MESSAGE, // message type JOptionPane.DEFAULT_OPTION, // option type null, // optional icon, use null to use the default icon OPTIONS, // options string array, will be made into buttons OPTIONS[0]); dialog = pane.createDialog(parent, "System Request"); // add the listener that will set the focus to the desired option dialog.addWindowListener(new WindowAdapter() { public void windowOpened(WindowEvent e) { text.requestFocus(); } }); }
Example 6
Source File: LoneOptionDialog.java From stendhal with GNU General Public License v2.0 | 5 votes |
/** * Show a confirmation dialog with specified, selectable message. * * @param message message string * @param title window title * @param optionType type of option, These are specified in JOptionDialog * @param messageType type of message, These are specified in JOptionDialog * * @return integer indicating the option selected by the user */ static int showConfirmDialog(String message, String title, int optionType, int messageType) { JOptionPane pane = new JOptionPane(new SelectableLabel(message), messageType, optionType); JDialog dialog = pane.createDialog(title); dialog.setDefaultCloseOperation(WindowConstants.HIDE_ON_CLOSE); setLocation(dialog); dialog.setVisible(true); dialog.dispose(); Object selectedValue = pane.getValue(); if (selectedValue == null) { return JOptionPane.CLOSED_OPTION; } Object[] options = pane.getOptions(); if (options == null) { if (selectedValue instanceof Integer) { return (Integer) selectedValue; } return JOptionPane.CLOSED_OPTION; } for (int i = 0; i < options.length; i++) { if (options[i].equals(selectedValue)) { return i; } } return JOptionPane.CLOSED_OPTION; }
Example 7
Source File: LoneOptionDialog.java From stendhal with GNU General Public License v2.0 | 5 votes |
/** * Show a message dialog with specified, selectable message. * * @param message message string * @param title title of the dialog window * @param messageType type of the message. These are specified in * JOptionDialog */ static void showMessageDialog(String message, String title, int messageType) { JOptionPane pane = new JOptionPane(new SelectableLabel(message), messageType); JDialog dialog = pane.createDialog(title); dialog.setDefaultCloseOperation(WindowConstants.HIDE_ON_CLOSE); setLocation(dialog); dialog.setVisible(true); dialog.dispose(); }
Example 8
Source File: GUIInputHandler.java From rapidminer-studio with GNU Affero General Public License v3.0 | 5 votes |
@Override public String inputPassword(String messageText) { final JPasswordField passwordField = new JPasswordField(); JOptionPane jop = new JOptionPane(new Object[] { messageText, passwordField }, JOptionPane.QUESTION_MESSAGE, JOptionPane.OK_CANCEL_OPTION); JDialog dialog = jop.createDialog("Authentication required"); dialog.addComponentListener(new ComponentAdapter() { @Override public void componentShown(ComponentEvent e) { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { passwordField.requestFocusInWindow(); passwordField.requestFocus(); } }); } }); dialog.setVisible(true); int result = (Integer) jop.getValue(); if (result == JOptionPane.OK_OPTION) { return new String(passwordField.getPassword()); } else { return null; } }
Example 9
Source File: SqlLoader.java From CQL with GNU Affero General Public License v3.0 | 5 votes |
private static void doHelp() { JTextArea jta = new JTextArea(help); jta.setWrapStyleWord(true); jta.setLineWrap(true); JScrollPane p = new JScrollPane(jta, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); p.setPreferredSize(new Dimension(300, 200)); JOptionPane pane = new JOptionPane(p); JDialog dialog = pane.createDialog(null, "Help on SQL Loader"); dialog.setModal(false); dialog.setVisible(true); dialog.setResizable(true); }
Example 10
Source File: TaskYesNoAllDialog.java From wpcleaner with Apache License 2.0 | 5 votes |
/** * @see java.lang.Runnable#run() */ @Override public void run() { Object[] options = new Object[] { GT._T("Yes"), GT._T("Yes to all"), GT._T("No"), GT._T("No to all"), }; JOptionPane pane = new JOptionPane( message, JOptionPane.WARNING_MESSAGE, JOptionPane.YES_NO_OPTION, null, options); JDialog dialog = pane.createDialog(parent, Version.PROGRAM); dialog.setVisible(true); Object selectedValue = pane.getValue(); if (selectedValue == null) { result = JOptionPane.CLOSED_OPTION; } else if (options[0].equals(selectedValue)) { result = JOptionPane.YES_OPTION; } else if (options[1].equals(selectedValue)) { result = Utilities.YES_ALL_OPTION; } else if (options[2].equals(selectedValue)) { result = JOptionPane.NO_OPTION; } else if (options[3].equals(selectedValue)) { result = Utilities.NO_ALL_OPTION; } else { result = JOptionPane.CLOSED_OPTION; } }
Example 11
Source File: DialogInputReader.java From obevo with Apache License 2.0 | 5 votes |
@Override public String readLine(String promptMessage) { final JTextField juf = new JTextField(); JOptionPane juop = new JOptionPane(juf, JOptionPane.QUESTION_MESSAGE, JOptionPane.OK_CANCEL_OPTION); JDialog userDialog = juop.createDialog(promptMessage); userDialog.addComponentListener(new ComponentAdapter() { @Override public void componentShown(ComponentEvent e) { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { juf.requestFocusInWindow(); } }); } }); userDialog.setVisible(true); int uresult = (Integer) juop.getValue(); userDialog.dispose(); String userName = null; if (uresult == JOptionPane.OK_OPTION) { userName = new String(juf.getText()); } if (StringUtils.isEmpty(userName)) { return null; } else { return userName; } }
Example 12
Source File: XgappUpgradeSelector.java From gate-core with GNU Lesser General Public License v3.0 | 5 votes |
public boolean showDialog(Window parent) { JOptionPane optionPane = new JOptionPane(mainPanel, JOptionPane.PLAIN_MESSAGE, JOptionPane.OK_CANCEL_OPTION); JDialog dialog = optionPane.createDialog(parent, "Select plugin versions"); dialog.setResizable(true); dialog.setVisible(true); return (((Integer)optionPane.getValue()).intValue() == JOptionPane.OK_OPTION); }
Example 13
Source File: Messages.java From jclic with GNU General Public License v2.0 | 5 votes |
private static boolean showDlg(Component parent, JOptionPane pane, String title) { if (parent != null && !(parent instanceof java.awt.Frame)) { parent = JOptionPane.getFrameForComponent(parent); } JDialog dialog = pane.createDialog(parent, title); pane.selectInitialValue(); return showDlg(dialog); }
Example 14
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 15
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 16
Source File: AltConfigWizard.java From CogniCrypt with Eclipse Public License 2.0 | 4 votes |
/** * This method is called once the user selects an instance. It writes the instance to an xml file and calls the code generation. * * @return <code>true</code>/<code>false</code> if writing instance file and code generation are (un)successful */ @Override public boolean performFinish() { boolean ret = false; final CodeGenerators genKind = selectedTask.getCodeGen(); CodeGenerator codeGenerator = null; String additionalResources = selectedTask.getAdditionalResources(); final LocatorPage currentPage = (LocatorPage) getContainer().getCurrentPage(); IResource targetFile = (IResource) currentPage.getSelectedResource().getFirstElement(); String taskName = selectedTask.getName(); JOptionPane optionPane = new JOptionPane("CogniCrypt is now generating code that implements " + selectedTask.getDescription() + "\ninto file " + ((targetFile != null) ? targetFile.getName() : "Output.java") + ". This should take no longer than a few seconds.", JOptionPane.INFORMATION_MESSAGE, JOptionPane.DEFAULT_OPTION, null, new Object[] {}, null); JDialog waitingDialog = optionPane.createDialog("Generating Code"); waitingDialog.setModal(false); waitingDialog.setVisible(true); Configuration chosenConfig = null; try { switch (genKind) { case CrySL: CrySLBasedCodeGenerator.clearParameterCache(); File templateFile = CodeGenUtils.getResourceFromWithin(selectedTask.getCodeTemplate()).listFiles()[0]; codeGenerator = new CrySLBasedCodeGenerator(targetFile); String projectRelDir = Constants.outerFileSeparator + codeGenerator.getDeveloperProject() .getSourcePath() + Constants.outerFileSeparator + Constants.PackageName + Constants.outerFileSeparator; String pathToTemplateFile = projectRelDir + templateFile.getName(); String resFileOSPath = ""; IPath projectPath = targetFile.getProject().getRawLocation(); if (projectPath == null) { projectPath = targetFile.getProject().getLocation(); } resFileOSPath = projectPath.toOSString() + pathToTemplateFile; Files.createDirectories(Paths.get(projectPath.toOSString() + projectRelDir)); Files.copy(templateFile.toPath(), Paths.get(resFileOSPath), StandardCopyOption.REPLACE_EXISTING); codeGenerator.getDeveloperProject().refresh(); resetAnswers(); chosenConfig = new CrySLConfiguration(resFileOSPath, ((CrySLBasedCodeGenerator) codeGenerator).setUpTemplateClass(pathToTemplateFile)); break; case XSL: this.constraints = (this.constraints != null) ? this.constraints : new HashMap<>(); final InstanceGenerator instanceGenerator = new InstanceGenerator(CodeGenUtils.getResourceFromWithin(selectedTask.getModelFile()) .getAbsolutePath(), "c0_" + taskName, selectedTask.getDescription()); instanceGenerator.generateInstances(this.constraints); // Initialize Code Generation codeGenerator = new XSLBasedGenerator(targetFile, selectedTask.getCodeTemplate()); chosenConfig = new XSLConfiguration(instanceGenerator.getInstances().values().iterator() .next(), this.constraints, codeGenerator.getDeveloperProject().getProjectPath() + Constants.innerFileSeparator + Constants.pathToClaferInstanceFile); break; default: return false; } ret = codeGenerator.generateCodeTemplates(chosenConfig, additionalResources); try { codeGenerator.getDeveloperProject().refresh(); } catch (CoreException e1) { Activator.getDefault().logError(e1); } } catch (Exception ex) { Activator.getDefault().logError(ex); } finally { waitingDialog.setVisible(false); waitingDialog.dispose(); } return ret; }
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: Macronizer.java From tn5250j with GNU General Public License v2.0 | 4 votes |
public static void showRunScriptDialog(SessionPanel session) { JPanel rsp = new JPanel(); rsp.setLayout(new BorderLayout()); JLabel jl = new JLabel("Enter script to run"); final JTextField rst = new JTextField(); rsp.add(jl,BorderLayout.NORTH); rsp.add(rst,BorderLayout.CENTER); Object[] message = new Object[1]; message[0] = rsp; String[] options = {"Run","Cancel"}; final JOptionPane pane = new JOptionPane( message, // the dialog message array JOptionPane.QUESTION_MESSAGE, // message type JOptionPane.DEFAULT_OPTION, // option type null, // optional icon, use null to use the default icon options, // options string array, will be made into buttons// options[0]); // option that should be made into a default button // create a dialog wrapping the pane final JDialog dialog = pane.createDialog(session, // parent frame "Run Script" // dialog title ); // add the listener that will set the focus to // the desired option dialog.addWindowListener( new WindowAdapter() { public void windowOpened( WindowEvent e) { super.windowOpened( e ); // now we're setting the focus to the desired component // it's not the best solution as it depends on internals // of the OptionPane class, but you can use it temporarily // until the bug gets fixed // also you might want to iterate here thru the set of // the buttons and pick one to call requestFocus() for it rst.requestFocus(); } }); dialog.setVisible(true); // now we can process the value selected // now we can process the value selected // if its Integer, the user most likely hit escape Object myValue = pane.getValue(); if (!(myValue instanceof Integer)) { String value = (String) myValue; if (value.equals(options[0])) { // send option along with system request if (rst.getText().length() > 0) { invoke(rst.getText(), session); } } } }
Example 19
Source File: UsernamePassword.java From OpenDA with GNU Lesser General Public License v3.0 | 4 votes |
/** * Ask using a GUI for the username and password. */ private void readFromGUI() { // Create fields for user name. final JTextField usernameField = new JTextField(20); usernameField.setText(this.username); final JLabel usernameLabel = new JLabel("Username: "); usernameLabel.setLabelFor(usernameField); final JPanel usernamePane = new JPanel(new FlowLayout(FlowLayout.TRAILING)); usernamePane.add(usernameLabel); usernamePane.add(usernameField); // Create fields for password. final JPasswordField passwordField = new JPasswordField(20); passwordField.setText(this.password); final JLabel passwordLabel = new JLabel("Password: "); passwordLabel.setLabelFor(passwordField); final JPanel passwordPane = new JPanel(new FlowLayout(FlowLayout.TRAILING)); passwordPane.add(passwordLabel); passwordPane.add(passwordField); // Create panel final JPanel main = new JPanel(); main.setLayout(new BoxLayout(main, BoxLayout.PAGE_AXIS)); main.add(usernamePane); main.add(passwordPane); // Create and handle dialog final JOptionPane jop = new JOptionPane(main, JOptionPane.QUESTION_MESSAGE, JOptionPane.OK_CANCEL_OPTION); final JDialog dialog = jop.createDialog("User name and password"); dialog.addComponentListener(new ComponentAdapter() { public void componentShown(ComponentEvent e) { SwingUtilities.invokeLater(new Runnable() { public void run() { if (usernameField.getText().isEmpty()) { usernameField.requestFocusInWindow(); } else { passwordField.requestFocusInWindow(); } } }); } }); dialog.setVisible(true); final Integer result = (Integer) jop.getValue(); dialog.dispose(); if (result.intValue() == JOptionPane.OK_OPTION) { this.username = usernameField.getText(); final char[] pwd = passwordField.getPassword(); this.password = new String(pwd); } }
Example 20
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); }