private void showProgressPanel(List<ComponentDescription> comps, boolean install) { final ProgressPanel pp = new ProgressPanel(comps, install); final JOptionPane optionPane = new JOptionPane(pp, JOptionPane.PLAIN_MESSAGE, JOptionPane.DEFAULT_OPTION, null, new String[] { "Abort" }, "Abort"); // optionPane.setPreferredSize(new Dimension(640,480)); final JDialog dialog = new JDialog((Frame) null, "Progress", false); dialog.setContentPane(optionPane); optionPane.addPropertyChangeListener(new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent e) { String prop = e.getPropertyName(); if (dialog.isVisible() && (e.getSource() == optionPane) && (prop.equals(JOptionPane.VALUE_PROPERTY))) { pp.requestExit(); dialog.setVisible(false); } } }); dialog.pack(); dialog.setVisible(true); new Thread(pp).start(); }
private void showProgressPanel(List<ComponentDescription> comps, boolean install) { final ProgressPanel pp = new ProgressPanel(comps, install); final JOptionPane optionPane = new JOptionPane(pp, JOptionPane.PLAIN_MESSAGE, JOptionPane.DEFAULT_OPTION, null, new String[] { "Abort" }, "Abort"); // optionPane.setPreferredSize(new Dimension(640,480)); final JDialog dialog = new JDialog((Frame) null, "Progress", false); dialog.setContentPane(optionPane); optionPane.addPropertyChangeListener(new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent e) { String prop = e.getPropertyName(); if (dialog.isVisible() && (e.getSource() == optionPane) && (prop.equals(JOptionPane.VALUE_PROPERTY))) { pp.requestExit(); dialog.setVisible(false); } } }); dialog.pack(); dialog.setVisible(true); new Thread(pp).start(); }
private void miProxy1ActionPerformed(java.awt.event.ActionEvent evt) {// GEN-FIRST:event_miProxy1ActionPerformed ProxyPanel prp = new ProxyPanel(System.getProperty("http.proxyHost"), System.getProperty("http.proxyPort")); final JOptionPane optionPane = new JOptionPane(prp, JOptionPane.PLAIN_MESSAGE, JOptionPane.YES_NO_OPTION, null, new String[] { "OK", "Cancel" }, "OK"); final JDialog dialog = new JDialog((Frame) null, "", true); dialog.setContentPane(optionPane); optionPane.addPropertyChangeListener(new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent e) { String prop = e.getPropertyName(); if (dialog.isVisible() && (e.getSource() == optionPane) && (prop.equals(JOptionPane.VALUE_PROPERTY))) { dialog.setVisible(false); } } }); dialog.pack(); dialog.setVisible(true); if ("OK".equals(optionPane.getValue())) { System.setProperty("http.proxyHost", prp.getProxyHost()); System.setProperty("http.proxyPort", prp.getProxyPort()); } }// GEN-LAST:event_miProxy1ActionPerformed
private void miProxy1ActionPerformed(java.awt.event.ActionEvent evt) {// GEN-FIRST:event_miProxy1ActionPerformed ProxyPanel prp = new ProxyPanel(System.getProperty("http.proxyHost"), System.getProperty("http.proxyPort")); final JOptionPane optionPane = new JOptionPane(prp, JOptionPane.PLAIN_MESSAGE, JOptionPane.YES_NO_OPTION, null, new String[] { "OK", "Cancel" }, "OK"); final JDialog dialog = new JDialog((Frame) null, "", true); dialog.setContentPane(optionPane); optionPane.addPropertyChangeListener(new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent e) { String prop = e.getPropertyName(); if (dialog.isVisible() && (e.getSource() == optionPane) && (prop.equals(JOptionPane.VALUE_PROPERTY))) { dialog.setVisible(false); } } }); dialog.pack(); dialog.setVisible(true); if ("OK".equals(optionPane.getValue())) { System.setProperty("http.proxyHost", prp.getProxyHost()); System.setProperty("http.proxyPort", prp.getProxyPort()); } }// GEN-LAST:event_miProxy1ActionPerformed
final JDialog dialog = new JDialog((Frame) null, "Do you accept the following license?", true); dialog.setContentPane(optionPane); optionPane.addPropertyChangeListener(new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent e) { String prop = e.getPropertyName();
@Override protected PasswordAuthentication getPasswordAuthentication() { PasswordPanel passP = new PasswordPanel(); final JOptionPane optionPane = new JOptionPane(passP, JOptionPane.PLAIN_MESSAGE, JOptionPane.DEFAULT_OPTION, null, new String[] { "OK", "Cancel" }, "OK"); final JDialog dialog = new JDialog((Frame) null, "", true); dialog.setContentPane(optionPane); optionPane.addPropertyChangeListener(new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent e) { String prop = e.getPropertyName(); if (dialog.isVisible() && (e.getSource() == optionPane) && (prop.equals(JOptionPane.VALUE_PROPERTY))) { dialog.setVisible(false); } } }); dialog.pack(); dialog.setVisible(true); if ("OK".equals(optionPane.getValue())) { return new PasswordAuthentication(passP.getUser(), passP.getPassword()); } return null; } });
final JDialog dialog = new JDialog((Frame) null, "Do you accept the following license?", true); dialog.setContentPane(optionPane); optionPane.addPropertyChangeListener(new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent e) { String prop = e.getPropertyName();
@Override protected PasswordAuthentication getPasswordAuthentication() { PasswordPanel passP = new PasswordPanel(); final JOptionPane optionPane = new JOptionPane(passP, JOptionPane.PLAIN_MESSAGE, JOptionPane.DEFAULT_OPTION, null, new String[] { "OK", "Cancel" }, "OK"); final JDialog dialog = new JDialog((Frame) null, "", true); dialog.setContentPane(optionPane); optionPane.addPropertyChangeListener(new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent e) { String prop = e.getPropertyName(); if (dialog.isVisible() && (e.getSource() == optionPane) && (prop.equals(JOptionPane.VALUE_PROPERTY))) { dialog.setVisible(false); } } }); dialog.pack(); dialog.setVisible(true); if ("OK".equals(optionPane.getValue())) { return new PasswordAuthentication(passP.getUser(), passP.getPassword()); } return null; } });
/** * @inheritDoc */ @Override protected void installListeners() { super.installListeners(); optionPane.addPropertyChangeListener(this); }
@Override protected void installListeners() { super.installListeners(); _propertyListener = new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent evt) { if (JideOptionPane.DETAILS_PROPERTY.equals(evt.getPropertyName())) { updateDetailsComponent(); if (_buttonArea instanceof ButtonPanel) { Component detailsButton = ((ButtonPanel) _buttonArea).getButtonByName(ButtonNames.DETAILS); if (detailsButton != null) { detailsButton.setVisible(evt.getNewValue() != null); } } } else if (JideOptionPane.TITLE_PROPERTY.equals(evt.getPropertyName())) { updateTitleComponent(_bannerArea); } } }; optionPane.addPropertyChangeListener(_propertyListener); }
private void showProgressPanel(List<ComponentDescription> comps, boolean install) { final ProgressPanel pp = new ProgressPanel(comps, install); final JOptionPane optionPane = new JOptionPane(pp, JOptionPane.PLAIN_MESSAGE, JOptionPane.DEFAULT_OPTION, null, new String[] { "Abort" }, "Abort"); // optionPane.setPreferredSize(new Dimension(640,480)); final JDialog dialog = new JDialog((Frame) null, "Progress", false); dialog.setContentPane(optionPane); optionPane.addPropertyChangeListener(new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent e) { String prop = e.getPropertyName(); if (dialog.isVisible() && (e.getSource() == optionPane) && (prop.equals(JOptionPane.VALUE_PROPERTY))) { pp.requestExit(); dialog.setVisible(false); } } }); dialog.pack(); dialog.setVisible(true); new Thread(pp).start(); }
private void miProxy1ActionPerformed(java.awt.event.ActionEvent evt) {// GEN-FIRST:event_miProxy1ActionPerformed ProxyPanel prp = new ProxyPanel(System.getProperty("http.proxyHost"), System.getProperty("http.proxyPort")); final JOptionPane optionPane = new JOptionPane(prp, JOptionPane.PLAIN_MESSAGE, JOptionPane.YES_NO_OPTION, null, new String[] { "OK", "Cancel" }, "OK"); final JDialog dialog = new JDialog((Frame) null, "", true); dialog.setContentPane(optionPane); optionPane.addPropertyChangeListener(new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent e) { String prop = e.getPropertyName(); if (dialog.isVisible() && (e.getSource() == optionPane) && (prop.equals(JOptionPane.VALUE_PROPERTY))) { dialog.setVisible(false); } } }); dialog.pack(); dialog.setVisible(true); if ("OK".equals(optionPane.getValue())) { System.setProperty("http.proxyHost", prp.getProxyHost()); System.setProperty("http.proxyPort", prp.getProxyPort()); } }// GEN-LAST:event_miProxy1ActionPerformed
/** * User dialog asking to save the current document on exit. * */ private void showSaveExitDialog() { final JOptionPane optionPane = new JOptionPane("Would you like to save the current content?\n", JOptionPane.QUESTION_MESSAGE, JOptionPane.YES_NO_OPTION); final JDialog dialog = new JDialog(frame, "Save current?", true); dialog.setContentPane(optionPane); dialog.setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE); optionPane.addPropertyChangeListener(new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent e) { String prop = e.getPropertyName(); if (dialog.isVisible() && (e.getSource() == optionPane) && (prop.equals(JOptionPane.VALUE_PROPERTY))) { dialog.setVisible(false); } } }); dialog.pack(); dialog.setVisible(true); int value = (Integer) optionPane.getValue(); if (value == JOptionPane.YES_OPTION) { saveProperties(); } }
/** * Creates (and displays) a dialog * * @param optionPane * @param title * @param isModal */ private void createDialog(final JOptionPane optionPane, String title, boolean isModal) { Frame mainFrame = getDialogOwner(); final JDialog dialog = new JDialog(mainFrame, title, isModal); dialog.setTitle(title); dialog.getContentPane().add(optionPane); dialog.pack(); dialog.setResizable(false); optionPane.addPropertyChangeListener(new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent event) { if (dialog.isVisible() && (event.getPropertyName().equals(JOptionPane.VALUE_PROPERTY)) && event.getNewValue() != null && event.getNewValue() != JOptionPane.UNINITIALIZED_VALUE) { dialog.setVisible(false); dialog.dispose(); } } }); centerDialog(dialog, mainFrame); dialog.setVisible(true); }
@Override protected PasswordAuthentication getPasswordAuthentication() { PasswordPanel passP = new PasswordPanel(); final JOptionPane optionPane = new JOptionPane(passP, JOptionPane.PLAIN_MESSAGE, JOptionPane.DEFAULT_OPTION, null, new String[] { "OK", "Cancel" }, "OK"); final JDialog dialog = new JDialog((Frame) null, "", true); dialog.setContentPane(optionPane); optionPane.addPropertyChangeListener(new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent e) { String prop = e.getPropertyName(); if (dialog.isVisible() && (e.getSource() == optionPane) && (prop.equals(JOptionPane.VALUE_PROPERTY))) { dialog.setVisible(false); } } }); dialog.pack(); dialog.setVisible(true); if ("OK".equals(optionPane.getValue())) { return new PasswordAuthentication(passP.getUser(), passP.getPassword()); } return null; } });
public ConfirmDialog(String title, String message){ optionPane = new JOptionPane(message, JOptionPane.WARNING_MESSAGE, JOptionPane.YES_NO_OPTION); dialog = new JDialog(); dialog.setContentPane(optionPane); dialog.setTitle(title); dialog.pack(); dialog.setLocationRelativeTo(null); dialog.setModalityType(ModalityType.APPLICATION_MODAL); dialog.setDefaultCloseOperation(JDialog.HIDE_ON_CLOSE); dialog.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent we) { optionPane.setValue(JOptionPane.NO_OPTION); } }); optionPane.addPropertyChangeListener( new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent e) { dialog.setVisible(false); } }); dialog.setVisible(true); int value = ((Integer)optionPane.getValue()).intValue(); if (value == JOptionPane.NO_OPTION) { confirmed = false; } else { confirmed = true; } }
public AcquireImportDialog(ImportPanel importPanel, List<ImageElement> mediaList) { super(); this.importPanel = importPanel; this.mediaList = mediaList; int maxRange = 60; Preferences prefs = BundlePreferences.getDefaultPreferences(FrameworkUtil.getBundle(this.getClass()).getBundleContext()); if (prefs != null) { Preferences p = prefs.node(AcquireExplorer.PREFERENCE_NODE); maxRange = p.getInt(P_MAX_RANGE, maxRange); } spinner = new JSpinner(new SpinnerNumberModel(maxRange, 1, 5256000, 5)); // <=> 4 years optionPane = new JOptionPane(initPanel(), JOptionPane.QUESTION_MESSAGE, JOptionPane.OK_CANCEL_OPTION, null, OPTIONS, OPTIONS[0]); optionPane.addPropertyChangeListener(this); setContentPane(optionPane); setModal(true); setLocationRelativeTo(null); pack(); }
public AcquireNewSerieDialog(AcquireTabPanel acquireTabPanel, final List<ImageElement> medias) { this.acquireTabPanel = acquireTabPanel; this.medias = medias; optionPane = new JOptionPane(initPanel(), JOptionPane.QUESTION_MESSAGE, JOptionPane.OK_CANCEL_OPTION, null, AcquireImportDialog.OPTIONS, AcquireImportDialog.OPTIONS[0]); optionPane.addPropertyChangeListener(this); setContentPane(optionPane); setModal(true); pack(); }
dialog.setLocation(loc.x, loc.y+offset); pane.addPropertyChangeListener(new PropertyChangeListener()
private void init(Component parent, String title, boolean bModal, String message, int type) { if (type == QUESTION) { buttonLabels = new Object[] { Translatrix.getTranslationString("DialogAccept"), Translatrix.getTranslationString("DialogCancel") }; jOptionPane = new JOptionPane(new JLabel(message, SwingConstants.CENTER), JOptionPane.PLAIN_MESSAGE, JOptionPane.OK_CANCEL_OPTION, null, buttonLabels, buttonLabels[0]); } else { buttonLabels = new Object[] { Translatrix.getTranslationString("DialogClose") }; jOptionPane = new JOptionPane(new JLabel(message, SwingConstants.CENTER), JOptionPane.PLAIN_MESSAGE, JOptionPane.DEFAULT_OPTION, null, buttonLabels, buttonLabels[0]); } setContentPane(jOptionPane); setDefaultCloseOperation(DO_NOTHING_ON_CLOSE); jOptionPane.addPropertyChangeListener(new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent e) { String prop = e.getPropertyName(); if (isVisible() && (e.getSource() == jOptionPane) && (prop.equals(JOptionPane.VALUE_PROPERTY) || prop.equals(JOptionPane.INPUT_VALUE_PROPERTY))) { setVisible(false); } } }); this.pack(); setLocationRelativeTo(parent); this.setVisible(true); }