javax.swing.JOptionPane.getValue()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(7.9k)|赞(0)|评价(0)|浏览(134)

本文整理了Java中javax.swing.JOptionPane.getValue()方法的一些代码示例,展示了JOptionPane.getValue()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JOptionPane.getValue()方法的具体详情如下:
包路径:javax.swing.JOptionPane
类名称:JOptionPane
方法名:getValue

JOptionPane.getValue介绍

暂无

代码示例

代码示例来源:origin: libgdx/libgdx

dialog.dispose();
Object selectedValue = pane.getValue();

代码示例来源:origin: marytts/marytts

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

代码示例来源:origin: libgdx/libgdx

dialog.dispose();
Object selectedValue = pane.getValue();

代码示例来源:origin: marytts/marytts

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

代码示例来源:origin: libgdx/libgdx

dialog.dispose();
Object selectedValue = pane.getValue();

代码示例来源:origin: libgdx/libgdx

dialog.dispose();
Object selectedValue = pane.getValue();

代码示例来源:origin: stackoverflow.com

if (op.getValue() != null && op.getValue().equals(JOptionPane.OK_OPTION)) {
  String password = new String(pPnl.getPassword());
  System.err.println("You entered: " + password);

代码示例来源:origin: marytts/marytts

@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;
  }
});

代码示例来源:origin: marytts/marytts

dialog.setVisible(true);
if (!"Accept".equals(optionPane.getValue())) {
  System.out.println("License not accepted. Installation of component cannot proceed.");
  return false;

代码示例来源:origin: marytts/marytts

@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;
  }
});

代码示例来源:origin: marytts/marytts

dialog.setVisible(true);
if (!"Accept".equals(optionPane.getValue())) {
  System.out.println("License not accepted. Installation of component cannot proceed.");
  return false;

代码示例来源:origin: stackoverflow.com

&& (JOptionPane.VALUE_PROPERTY.equals(prop)
  || JOptionPane.INPUT_VALUE_PROPERTY.equals(prop))) {
Object value = optionPane.getValue();

代码示例来源:origin: org.fudaa.framework.ctulu/ctulu-ui

public String getDecisionValue()
  {
    return jOptionPane.getValue().toString();
  }
}

代码示例来源:origin: igniterealtime/Spark

public void propertyChange( PropertyChangeEvent e )
{
  if ( pane.getValue() instanceof Integer )
  {
    pane.removePropertyChangeListener( this );
    preferenceDialog.dispose();
  }
}

代码示例来源:origin: net.sf.ingenias/editor

public static int showConfirmDialog(Component parentComponent,
    Object message, String title,
    int optionType)
{
  JOptionPane pane = new JOptionPane(message, JOptionPane.PLAIN_MESSAGE, optionType);
  JDialog dialog = pane.createDialog(parentComponent, title);
  dialog.setLocationByPlatform(true);
  dialog.setVisible(true);
  if (pane.getValue() instanceof Integer)
    return ((Integer) pane.getValue()).intValue();
  return -1;
}

代码示例来源:origin: stackoverflow.com

JOptionPane pane = new JOptionPane("Message", JOptionPane.WARNING_MESSAGE,
    JOptionPane.DEFAULT_OPTION);
JDialog dialog = pane.createDialog("TITLE");
dialog.setLocation(0, 0);
dialog.setVisible(true);

// dialog box shown here

dialog.dispose();
Object selection = pane.getValue();

代码示例来源:origin: net.imagej/imagej-ui-swing

public static String getChoice(final Component owner,
  final List<String> list, final String question, final String title)
{
  final String[] array = list.toArray(new String[list.size()]);
  final JOptionPane pane =
    new JOptionPane(question, JOptionPane.QUESTION_MESSAGE,
      JOptionPane.OK_CANCEL_OPTION, null, array);
  pane.createDialog(owner, title).setVisible(true);
  return (String) pane.getValue();
}

代码示例来源:origin: stackoverflow.com

JOptionPane optionPane = new JOptionPane("File haven't save yet." +
     " \n Are you want to save the file?", JOptionPane.QUESTION_MESSAGE, JOptionPane.YES_NO_CANCEL_OPTION);
 JDialog dialog = optionPane.createDialog("Confirm Dialog");
 Set<AWTKeyStroke> focusTraversalKeys = new HashSet<AWTKeyStroke>(dialog.getFocusTraversalKeys(0));
 focusTraversalKeys.add(AWTKeyStroke.getAWTKeyStroke(KeyEvent.VK_RIGHT, KeyEvent.VK_UNDEFINED));
 dialog.setFocusTraversalKeys(0, focusTraversalKeys);
 dialog.setVisible(true);
 dialog.dispose();
 int option = (Integer) optionPane.getValue();

代码示例来源:origin: igniterealtime/Spark

public void propertyChange(PropertyChangeEvent e) {
  String value = (String) pane.getValue();
  if (Res.getString("cancel").equals(value)) {
    pane.removePropertyChangeListener(this);
    dlg.dispose();
  } else if (Res.getString("save").equals(value)) {
    pane.removePropertyChangeListener(this);
    dlg.dispose();
    saveVCard();
  }
  }
};

代码示例来源:origin: igniterealtime/Spark

public void propertyChange(PropertyChangeEvent e) {
  String value = (String) pane.getValue();
  if (Res.getString("close").equals(value)) {
    pane.removePropertyChangeListener(this);
    dlg.dispose();
  } else if (Res.getString("close").equals(value)) {
    pane.setValue(JOptionPane.UNINITIALIZED_VALUE);
  }
  }
};

相关文章