java.awt.Dialog Java Examples
The following examples show how to use
java.awt.Dialog.
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: JOptionPane.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
private JDialog createDialog(Component parentComponent, String title, int style) throws HeadlessException { final JDialog dialog; Window window = JOptionPane.getWindowForComponent(parentComponent); if (window instanceof Frame) { dialog = new JDialog((Frame)window, title, true); } else { dialog = new JDialog((Dialog)window, title, true); } if (window instanceof SwingUtilities.SharedOwnerFrame) { WindowListener ownerShutdownListener = SwingUtilities.getSharedOwnerFrameShutdownListener(); dialog.addWindowListener(ownerShutdownListener); } initDialog(dialog, style, parentComponent); return dialog; }
Example #2
Source File: MessageAuthenticationProfile.java From netbeans with Apache License 2.0 | 6 votes |
@Override() public void displayConfig(WSDLComponent component, UndoManager undoManager) { UndoCounter undoCounter = new UndoCounter(); WSDLModel model = component.getModel(); model.addUndoableEditListener(undoCounter); JPanel profConfigPanel = new MessageAuthentication(component, this); DialogDescriptor dlgDesc = new DialogDescriptor(profConfigPanel, getDisplayName()); Dialog dlg = DialogDisplayer.getDefault().createDialog(dlgDesc); dlg.setVisible(true); if (dlgDesc.getValue() == DialogDescriptor.CANCEL_OPTION) { for (int i=0; i<undoCounter.getCounter();i++) { if (undoManager.canUndo()) { undoManager.undo(); } } } model.removeUndoableEditListener(undoCounter); }
Example #3
Source File: ProfilerSessions.java From visualvm with GNU General Public License v2.0 | 6 votes |
private static ProfilerFeature selectFeature(Set<ProfilerFeature> features, String actionName) { UI ui = UI.selectFeature(features); HelpCtx helpCtx = new HelpCtx("SelectFeatureDialog.HelpCtx"); // NOI18N // TODO: should have a special one? String caption = actionName == null ? Bundle.ProfilerSessions_selectFeature() : actionName; DialogDescriptor dd = new DialogDescriptor(ui, caption, true, new Object[] { DialogDescriptor.OK_OPTION, DialogDescriptor.CANCEL_OPTION }, DialogDescriptor.OK_OPTION, DialogDescriptor.BOTTOM_ALIGN, helpCtx, null); Dialog d = DialogDisplayer.getDefault().createDialog(dd); d.setVisible(true); ProfilerFeature ret = dd.getValue() == DialogDescriptor.OK_OPTION ? ui.selectedFeature() : null; dd.setMessage(null); // Do not leak because of WindowsPopupMenuUI.mnemonicListener return ret; }
Example #4
Source File: JOptionPane.java From jdk8u_jdk with GNU General Public License v2.0 | 6 votes |
private JDialog createDialog(Component parentComponent, String title, int style) throws HeadlessException { final JDialog dialog; Window window = JOptionPane.getWindowForComponent(parentComponent); if (window instanceof Frame) { dialog = new JDialog((Frame)window, title, true); } else { dialog = new JDialog((Dialog)window, title, true); } if (window instanceof SwingUtilities.SharedOwnerFrame) { WindowListener ownerShutdownListener = SwingUtilities.getSharedOwnerFrameShutdownListener(); dialog.addWindowListener(ownerShutdownListener); } initDialog(dialog, style, parentComponent); return dialog; }
Example #5
Source File: AndroidCustomizerProvider.java From NBANDROID-V2 with Apache License 2.0 | 6 votes |
@Override public void showCustomizer() { Dialog dialog = ProjectCustomizer.createCustomizerDialog( //Path to layer folder: CUSTOMIZER_FOLDER_PATH, //Lookup, which must contain, at least, the Project: Lookups.fixed(project), //Preselected category: "", //OK button listener: new OKOptionListener(), //HelpCtx for Help button of dialog: null); dialog.setTitle(ProjectUtils.getInformation(project).getDisplayName()); dialog.setVisible(true); }
Example #6
Source File: ModalDialogOrderingTest.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
public static void main(String[] args) { final Frame frame = new Frame("Test"); frame.setSize(400, 400); frame.setBackground(FRAME_COLOR); frame.setVisible(true); final Dialog modalDialog = new Dialog(null, true); modalDialog.setTitle("Modal Dialog"); modalDialog.setSize(400, 200); modalDialog.setBackground(DIALOG_COLOR); modalDialog.setModal(true); new Thread(new Runnable() { @Override public void run() { runTest(modalDialog, frame); } }).start(); modalDialog.setVisible(true); }
Example #7
Source File: PbfSetupPanel.java From triplea with GNU General Public License v3.0 | 6 votes |
private void createComponents() { final JScrollPane scrollPane = new JScrollPane(localPlayerPanel); localPlayerPanel.addHierarchyListener( e -> { final Window window = SwingUtilities.getWindowAncestor(localPlayerPanel); if (window instanceof Dialog) { final Dialog dialog = (Dialog) window; if (!dialog.isResizable()) { dialog.setResizable(true); dialog.setMinimumSize(new Dimension(700, 700)); } } }); localPlayerSelection.addActionListener( e -> JOptionPane.showMessageDialog( PbfSetupPanel.this, scrollPane, "Select Local Players and AI's", JOptionPane.PLAIN_MESSAGE)); }
Example #8
Source File: ModalDialogOrderingTest.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
public static void main(String[] args) { final Frame frame = new Frame("Test"); frame.setSize(400, 400); frame.setBackground(FRAME_COLOR); frame.setVisible(true); final Dialog modalDialog = new Dialog(null, true); modalDialog.setTitle("Modal Dialog"); modalDialog.setSize(400, 200); modalDialog.setBackground(DIALOG_COLOR); modalDialog.setModal(true); new Thread(new Runnable() { @Override public void run() { runTest(modalDialog, frame); } }).start(); modalDialog.setVisible(true); }
Example #9
Source File: OutputPanel.java From netbeans with Apache License 2.0 | 6 votes |
private void targetsButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_targetsButtonActionPerformed UndoCounter undoCounter = new UndoCounter(); model.addUndoableEditListener(undoCounter); TargetsPanel targetsPanel = new TargetsPanel(output); //NOI18N DialogDescriptor dlgDesc = new DialogDescriptor(targetsPanel, NbBundle.getMessage(InputPanel.class, "LBL_Targets_Panel_Title")); //NOI18N Dialog dlg = DialogDisplayer.getDefault().createDialog(dlgDesc); dlg.setVisible(true); if (dlgDesc.getValue() == DialogDescriptor.CANCEL_OPTION) { for (int i=0; i<undoCounter.getCounter();i++) { if (undoManager.canUndo()) { undoManager.undo(); } } } else { SecurityPolicyModelHelper.getInstance(PolicyModelHelper.getConfigVersion(binding)).setTargets(output, targetsPanel.getTargetsModel()); } model.removeUndoableEditListener(undoCounter); }
Example #10
Source File: SplashUISupport.java From netbeans with Apache License 2.0 | 6 votes |
/** Creates a new instance of ColorChooser */ public ColorComboBox() { super(content); setRenderer(new Renderer()); setEditable(true); setEditor(new Renderer()); setSelectedItem(new Value(null, null)); addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ev) { if (getSelectedItem() == CUSTOM_COLOR) { Color c = JColorChooser.showDialog( SwingUtilities.getAncestorOfClass (Dialog.class, ColorComboBox.this), loc("SelectColor"), // NOI18N null ); setColor(c); } ColorComboBox.this.firePropertyChange(PROP_COLOR, null, null); } }); }
Example #11
Source File: WindowBuilders.java From netbeans with Apache License 2.0 | 6 votes |
static ComponentBuilder getBuilder(Instance instance, Heap heap) { if (DetailsUtils.isSubclassOf(instance, JRootPane.class.getName())) { return new JRootPaneBuilder(instance, heap); } else if (DetailsUtils.isSubclassOf(instance, JDesktopPane.class.getName())) { return new JDesktopPaneBuilder(instance, heap); } else if (DetailsUtils.isSubclassOf(instance, JLayeredPane.class.getName())) { return new JLayeredPaneBuilder(instance, heap); } else if (DetailsUtils.isSubclassOf(instance, Frame.class.getName())) { return new FrameBuilder(instance, heap); } else if (DetailsUtils.isSubclassOf(instance, Dialog.class.getName())) { return new DialogBuilder(instance, heap); } else if (DetailsUtils.isSubclassOf(instance, JInternalFrame.class.getName())) { return new JInternalFrameBuilder(instance, heap); } return null; }
Example #12
Source File: SdksCustomizer.java From NBANDROID-V2 with Apache License 2.0 | 6 votes |
/** * Shows platforms customizer * * @param platform which should be seelcted, may be null * @return boolean for future extension, currently always true */ public static boolean showCustomizer() { SdksCustomizer customizer = new SdksCustomizer(); javax.swing.JButton close = new javax.swing.JButton(NbBundle.getMessage(SdksCustomizer.class, "CTL_Close")); close.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(SdksCustomizer.class, "AD_Close")); DialogDescriptor descriptor = new DialogDescriptor(customizer, NbBundle.getMessage(SdksCustomizer.class, "TXT_PlatformsManager"), true, new Object[]{close}, close, DialogDescriptor.DEFAULT_ALIGN, new HelpCtx("org.nbandroid.netbeans.gradle.v2.sdk.ui.PlatformsCustomizer"), null); // NOI18N Dialog dlg = null; try { dlg = DialogDisplayer.getDefault().createDialog(descriptor); dlg.setVisible(true); } finally { if (dlg != null) { dlg.dispose(); } } return true; }
Example #13
Source File: ApisupportAntUIUtils.java From netbeans with Apache License 2.0 | 6 votes |
public static @CheckForNull NbModuleProject runProjectWizard( final NewNbModuleWizardIterator iterator, final String titleBundleKey) { WizardDescriptor wd = new WizardDescriptor(iterator); wd.setTitleFormat(new MessageFormat("{0}")); // NOI18N wd.setTitle(NbBundle.getMessage(ApisupportAntUIUtils.class, titleBundleKey)); Dialog dialog = DialogDisplayer.getDefault().createDialog(wd); dialog.setVisible(true); dialog.toFront(); NbModuleProject project = null; boolean cancelled = wd.getValue() != WizardDescriptor.FINISH_OPTION; if (!cancelled) { FileObject folder = iterator.getCreateProjectFolder(); if (folder == null) { return null; } try { project = (NbModuleProject) ProjectManager.getDefault().findProject(folder); OpenProjects.getDefault().open(new Project[] { project }, false); } catch (IOException e) { ErrorManager.getDefault().notify(ErrorManager.INFORMATIONAL, e); } } return project; }
Example #14
Source File: Selenium2Customizer.java From netbeans with Apache License 2.0 | 6 votes |
@NbBundle.Messages("MSG_CONFIGURE=Configure Selenium Server") public static boolean showCustomizer() { Selenium2Customizer panel = new Selenium2Customizer(); DialogDescriptor descriptor = new DialogDescriptor(panel, Bundle.MSG_CONFIGURE()); panel.setDescriptor(descriptor); Dialog dialog = DialogDisplayer.getDefault().createDialog(descriptor); dialog.setModal(true); dialog.setVisible(true); dialog.dispose(); if (descriptor.getValue() == DialogDescriptor.OK_OPTION) { Selenium2ServerSupport.getPrefs().put(Selenium2ServerSupport.SELENIUM_SERVER_JAR, panel.tfSeleniumServerJar.getText()); Selenium2ServerSupport.getPrefs().put(Selenium2ServerSupport.FIREFOX_PROFILE_TEMPLATE_DIR, panel.tfFirefoxProfileDir.getText()); Selenium2ServerSupport.getPrefs().put(Selenium2ServerSupport.USER_EXTENSION_FILE, panel.tfUserExtensionFile.getText()); Selenium2ServerSupport.getPrefs().putInt(Selenium2ServerSupport.PORT, Integer.parseInt(panel.spinnerPort.getValue().toString())); Selenium2ServerSupport.getPrefs().putBoolean(Selenium2ServerSupport.SINGLE_WINDOW, panel.cbSingleWindow.isSelected()); return true; } else { return false; } }
Example #15
Source File: MethodExceptionDialog.java From netbeans with Apache License 2.0 | 6 votes |
public void showDialog(JComponent invoker) { DialogDescriptor dlg = new DialogDescriptor( this, NbBundle.getMessage(this.getClass(), "CLIENT_EXCEPTION"), // NOI18N false, NotifyDescriptor.OK_CANCEL_OPTION, DialogDescriptor.OK_OPTION, DialogDescriptor.DEFAULT_ALIGN, HelpCtx.DEFAULT_HELP, null); dlg.setOptions(new Object[] { okButton }); Dialog dialog = DialogDisplayer.getDefault().createDialog(dlg); dialog.setPreferredSize(new Dimension(500,300)); dialog.setLocationRelativeTo(invoker); dialog.setVisible(true); }
Example #16
Source File: MissingEventsOnModalDialogTest.java From dragonwell8_jdk with GNU General Public License v2.0 | 6 votes |
private static void clickOnDialog(Dialog dialog) { try { long time = System.currentTimeMillis() + 200; while (!dialog.isVisible()) { if (time < System.currentTimeMillis()) { throw new RuntimeException("Dialog is not visible!"); } Thread.sleep(10); } Point point = getCenterPoint(dialog); Robot robot = new Robot(); robot.setAutoDelay(50); robot.mouseMove(point.x, point.y); robot.mousePress(InputEvent.BUTTON1_MASK); robot.mouseRelease(InputEvent.BUTTON1_MASK); } catch (Exception e) { throw new RuntimeException(e); } }
Example #17
Source File: BindingPanel.java From netbeans with Apache License 2.0 | 5 votes |
private void keyButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_keyButtonActionPerformed KeystorePanel storePanel = new KeystorePanel(binding, project, jsr109, false, getUserExpectedConfigVersion()); DialogDescriptor dlgDesc = new DialogDescriptor(storePanel, NbBundle.getMessage(BindingPanel.class, "LBL_Keystore_Panel_Title")); //NOI18N Dialog dlg = DialogDisplayer.getDefault().createDialog(dlgDesc); dlg.setVisible(true); if (dlgDesc.getValue() == DialogDescriptor.OK_OPTION) { storePanel.storeState(); } }
Example #18
Source File: JFileChooser.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * Creates and returns a new <code>JDialog</code> wrapping * <code>this</code> centered on the <code>parent</code> * in the <code>parent</code>'s frame. * This method can be overriden to further manipulate the dialog, * to disable resizing, set the location, etc. Example: * <pre> * class MyFileChooser extends JFileChooser { * protected JDialog createDialog(Component parent) throws HeadlessException { * JDialog dialog = super.createDialog(parent); * dialog.setLocation(300, 200); * dialog.setResizable(false); * return dialog; * } * } * </pre> * * @param parent the parent component of the dialog; * can be <code>null</code> * @return a new <code>JDialog</code> containing this instance * @exception HeadlessException if GraphicsEnvironment.isHeadless() * returns true. * @see java.awt.GraphicsEnvironment#isHeadless * @since 1.4 */ protected JDialog createDialog(Component parent) throws HeadlessException { FileChooserUI ui = getUI(); String title = ui.getDialogTitle(this); putClientProperty(AccessibleContext.ACCESSIBLE_DESCRIPTION_PROPERTY, title); JDialog dialog; Window window = JOptionPane.getWindowForComponent(parent); if (window instanceof Frame) { dialog = new JDialog((Frame)window, title, true); } else { dialog = new JDialog((Dialog)window, title, true); } dialog.setComponentOrientation(this.getComponentOrientation()); Container contentPane = dialog.getContentPane(); contentPane.setLayout(new BorderLayout()); contentPane.add(this, BorderLayout.CENTER); if (JDialog.isDefaultLookAndFeelDecorated()) { boolean supportsWindowDecorations = UIManager.getLookAndFeel().getSupportsWindowDecorations(); if (supportsWindowDecorations) { dialog.getRootPane().setWindowDecorationStyle(JRootPane.FILE_CHOOSER_DIALOG); } } dialog.pack(); dialog.setLocationRelativeTo(parent); return dialog; }
Example #19
Source File: DependenciesPanel.java From netbeans with Apache License 2.0 | 5 votes |
/** * Shows the search panel. */ @NbBundle.Messages({ "DependenciesPanel.editDialog.title=Edit Bower package", "DependenciesPanel.editDialog.update=Update", "DependenciesPanel.editDialog.cancel=Cancel" }) private void showEditDialog() { EditPanel panel = new EditPanel(); int border = LayoutStyle.getInstance().getContainerGap(panel, SwingConstants.NORTH, null); panel.setBorder(BorderFactory.createEmptyBorder(border, border, border, border)); panel.setLibraryProvider(LibraryProvider.forProject(project)); int selectedRow = table.getSelectedRow(); Dependency dependency = dependencies.get(selectedRow); panel.setDependency(dependency); String update = Bundle.DependenciesPanel_editDialog_update(); String cancel = Bundle.DependenciesPanel_editDialog_cancel(); DialogDescriptor descriptor = new DialogDescriptor( panel, Bundle.DependenciesPanel_editDialog_title(), true, new Object[] { update, cancel}, update, DialogDescriptor.DEFAULT_ALIGN, HelpCtx.DEFAULT_HELP, null ); Dialog dialog = DialogDisplayer.getDefault().createDialog(descriptor); dialog.setVisible(true); if (update.equals(descriptor.getValue())) { addLibrary(dependency.getName(), panel.getRequiredVersion(), panel.getInstalledVersion()); } }
Example #20
Source File: RevertModifications.java From netbeans with Apache License 2.0 | 5 votes |
public boolean showDialog() { DialogDescriptor dialogDescriptor = new DialogDescriptor(panel, org.openide.util.NbBundle.getMessage(RevertModifications.class, "CTL_RevertDialog")); // NOI18N dialogDescriptor.setOptions(new Object[] {okButton, cancelButton}); dialogDescriptor.setModal(true); dialogDescriptor.setHelpCtx(new HelpCtx(this.getClass())); dialogDescriptor.setValid(false); Dialog dialog = DialogDisplayer.getDefault().createDialog(dialogDescriptor); dialog.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(RevertModifications.class, "ACSD_RevertDialog")); // NOI18N dialog.setVisible(true); dialog.setResizable(false); boolean ret = dialogDescriptor.getValue() == okButton; return ret; }
Example #21
Source File: DialogDisplayerImplTest.java From netbeans with Apache License 2.0 | 5 votes |
public void testParent() { DialogDescriptor dd = new DialogDescriptor (pane, "Owner"); Dialog dlg = DialogDisplayer.getDefault ().createDialog (dd, null); assertEquals(WindowManager.getDefault().getMainWindow(), dlg.getOwner()); Frame frame = new Frame(); dlg = DialogDisplayer.getDefault ().createDialog (dd ,frame); assertEquals(frame, dlg.getOwner()); }
Example #22
Source File: HelpDialogFactory.java From lucene-solr with Apache License 2.0 | 5 votes |
@Override public JDialog create(Window owner, String title, int width, int height) { dialog = new JDialog(owner, title, Dialog.ModalityType.APPLICATION_MODAL); dialog.add(content()); dialog.setSize(new Dimension(width, height)); dialog.setLocationRelativeTo(owner); dialog.getContentPane().setBackground(prefs.getColorTheme().getBackgroundColor()); return dialog; }
Example #23
Source File: DialogSupport.java From netbeans with Apache License 2.0 | 5 votes |
public Dialog createDialog( String title, JPanel panel, boolean modal, JButton[] buttons, boolean sidebuttons, int defaultIndex, int cancelIndex, ActionListener listener) { return origFactory.createDialog(title, panel, modal, buttons, sidebuttons, defaultIndex, cancelIndex, listener); }
Example #24
Source File: JFXDeploymentPanel.java From netbeans with Apache License 2.0 | 5 votes |
private void buttonIconsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonIconsActionPerformed JFXIconsPanel panel = new JFXIconsPanel(jfxProps, lastImageFolder); panel.registerDocumentListeners(); DialogDescriptor dialogDesc = new DialogDescriptor(panel, NbBundle.getMessage(JFXIconsPanel.class, "TITLE_JFXIconsPanel"), true, null); // NOI18N Dialog dialog = DialogDisplayer.getDefault().createDialog(dialogDesc); dialog.setVisible(true); if (dialogDesc.getValue() == DialogDescriptor.OK_OPTION) { panel.store(); refreshIconsLabel(); } panel.unregisterDocumentListeners(); }
Example #25
Source File: JFileChooser.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
/** * Creates and returns a new <code>JDialog</code> wrapping * <code>this</code> centered on the <code>parent</code> * in the <code>parent</code>'s frame. * This method can be overriden to further manipulate the dialog, * to disable resizing, set the location, etc. Example: * <pre> * class MyFileChooser extends JFileChooser { * protected JDialog createDialog(Component parent) throws HeadlessException { * JDialog dialog = super.createDialog(parent); * dialog.setLocation(300, 200); * dialog.setResizable(false); * return dialog; * } * } * </pre> * * @param parent the parent component of the dialog; * can be <code>null</code> * @return a new <code>JDialog</code> containing this instance * @exception HeadlessException if GraphicsEnvironment.isHeadless() * returns true. * @see java.awt.GraphicsEnvironment#isHeadless * @since 1.4 */ protected JDialog createDialog(Component parent) throws HeadlessException { FileChooserUI ui = getUI(); String title = ui.getDialogTitle(this); putClientProperty(AccessibleContext.ACCESSIBLE_DESCRIPTION_PROPERTY, title); JDialog dialog; Window window = JOptionPane.getWindowForComponent(parent); if (window instanceof Frame) { dialog = new JDialog((Frame)window, title, true); } else { dialog = new JDialog((Dialog)window, title, true); } dialog.setComponentOrientation(this.getComponentOrientation()); Container contentPane = dialog.getContentPane(); contentPane.setLayout(new BorderLayout()); contentPane.add(this, BorderLayout.CENTER); if (JDialog.isDefaultLookAndFeelDecorated()) { boolean supportsWindowDecorations = UIManager.getLookAndFeel().getSupportsWindowDecorations(); if (supportsWindowDecorations) { dialog.getRootPane().setWindowDecorationStyle(JRootPane.FILE_CHOOSER_DIALOG); } } dialog.pack(); dialog.setLocationRelativeTo(parent); return dialog; }
Example #26
Source File: ExecutableInputMethodManager.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
public synchronized void notifyChangeRequest(Component comp) { if (!(comp instanceof Frame || comp instanceof Dialog)) return; // if busy with the current request, ignore this request. if (requestComponent != null) return; requestComponent = comp; notify(); }
Example #27
Source File: AbstractDockingTest.java From ghidra with Apache License 2.0 | 5 votes |
private static String getDebugTitleForWindow(Window window, String defaultTitle) { if (window instanceof Frame) { return "Frame: '" + ((Frame) window).getTitle() + "'"; } else if (window instanceof Dialog) { return "Dialog: '" + ((Dialog) window).getTitle() + "'"; } return "Non-Frame/Dialog window: " + defaultTitle; }
Example #28
Source File: AttachDialog.java From visualvm with GNU General Public License v2.0 | 5 votes |
@Override public AttachSettings configure(AttachSettings settings, boolean partially) { if (settings == null) settings = new AttachSettings(); // Configure default settings if (settings.getTargetType().isEmpty()) { settings.setDirect(false); settings.setDynamic16(true); settings.setRemote(false); } // Configure implicit settings settings.setTargetType(Bundle.AttachDialog_JavaApplication()); settings.setServerType(Bundle.AttachDialog_JavaApplication()); // // Workaround for remote OS // if (settings.isRemote()) settings.setHostOS(null); panel = new Panel(); panel.setup(settings); DialogDescriptor dd = new DialogDescriptor(panel, Bundle.AttachDialog_Caption()); if (!partially) { dd.setValid(false); panel.setDisplayer(dd); } Dialog d = DialogDisplayer.getDefault().createDialog(dd); d.setVisible(true); AttachSettings result = dd.getValue() == DialogDescriptor.OK_OPTION ? panel.getSettings() : null; if (currentProvider != null) currentProvider.removeChangeListener(panel); currentProvider = null; panel = null; return result; }
Example #29
Source File: RPConfigDialog.java From RipplePower with Apache License 2.0 | 5 votes |
public RPConfigDialog(String text, JFrame parent) { super(parent, text, Dialog.ModalityType.DOCUMENT_MODAL); addWindowListener(HelperWindow.get()); setIconImage(UIRes.getIcon()); setResizable(false); Dimension dim = new Dimension(445, 535); setPreferredSize(dim); setSize(dim); initComponents(); }
Example #30
Source File: ImageableAreaTest.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
private static void createAndShowTestDialog(String description, String failMessage, Runnable action) { final JDialog dialog = new JDialog(); dialog.setTitle("Test: " + (++testCount)); dialog.setModalityType(Dialog.ModalityType.APPLICATION_MODAL); JTextArea textArea = new JTextArea(description); textArea.setEditable(false); final JButton testButton = new JButton("Print Table"); final JButton passButton = new JButton("PASS"); passButton.setEnabled(false); passButton.addActionListener((e) -> { dialog.dispose(); }); final JButton failButton = new JButton("FAIL"); failButton.setEnabled(false); failButton.addActionListener((e) -> { throw new RuntimeException(failMessage); }); testButton.addActionListener((e) -> { testButton.setEnabled(false); action.run(); passButton.setEnabled(true); failButton.setEnabled(true); }); JPanel mainPanel = new JPanel(new BorderLayout()); mainPanel.add(textArea, BorderLayout.CENTER); JPanel buttonPanel = new JPanel(new FlowLayout()); buttonPanel.add(testButton); buttonPanel.add(passButton); buttonPanel.add(failButton); mainPanel.add(buttonPanel, BorderLayout.SOUTH); dialog.add(mainPanel); dialog.pack(); dialog.setVisible(true); }