Examples of JOptionPane


Examples of javax.swing.JOptionPane

    JPanel panel  = new JPanel(new BorderLayout());

    panel.add(combo, BorderLayout.SOUTH);
    panel.add(msg,   BorderLayout.NORTH);

    JOptionPane optionPane = new JOptionPane(panel,
                                             JOptionPane.QUESTION_MESSAGE);
    optionPane.setIcon(connectIconLarge);
    optionPane.setRootFrame(frame);
    optionPane.setOptionType(JOptionPane.OK_CANCEL_OPTION);
    optionPane.setWantsInput(false);
    optionPane.setOptions(new String[]
      {
        Strings.get("ok"),
        Strings.get("cancel"),
        Strings.get("local"),
      });

    optionPane.selectInitialValue();

    JDialog dialog =
      optionPane.createDialog(frame,
                              Strings.get("remote_connect_title"));
    dialog.setVisible(true);
    dialog.dispose();

    if (!(optionPane.getValue() instanceof String)) { // We'll get an Integer if the user pressed Esc
      return;
    }

    String value = (String)optionPane.getValue();

    if (Strings.get("cancel").equals(value)) {
      return;
    }
View Full Code Here

Examples of javax.swing.JOptionPane

   * Displays this panel in a modal dialog box.
   */
  public void displayView(View parentView) {
    Component homeRoot = SwingUtilities.getRoot((Component)parentView);
    if (homeRoot != null) {
      JOptionPane optionPane = new JOptionPane(this,
          JOptionPane.PLAIN_MESSAGE, JOptionPane.OK_CANCEL_OPTION);
      JComponent parentComponent = SwingUtilities.getRootPane((JComponent)parentView);
      if (parentView != null) {
        optionPane.setComponentOrientation(parentComponent.getComponentOrientation());
      }
      JDialog dialog = optionPane.createDialog(parentComponent, this.dialogTitle);
      Dimension screenSize = getToolkit().getScreenSize();
      Insets screenInsets = getToolkit().getScreenInsets(getGraphicsConfiguration());
      // Check dialog isn't too high
      int screenHeight = screenSize.height - screenInsets.top - screenInsets.bottom;
      if (OperatingSystem.isLinux() && screenHeight == screenSize.height) {
View Full Code Here

Examples of javax.swing.JOptionPane

        Dimension dim = textArea.getPreferredSize();
        dim.height = dim.width*50/80;
        scrollPane.setPreferredSize(dim);

        // pass the scrollpane to the joptionpane.
        JDialog dialog = new JOptionPane(scrollPane, JOptionPane.PLAIN_MESSAGE).
                createDialog(this, "Calibration Data");
        dialog.setResizable(true);
        dialog.setModalityType(ModalityType.MODELESS);
        dialog.setVisible(true);
    }//GEN-LAST:event_calibrationExamineMenuItemActionPerformed
View Full Code Here

Examples of javax.swing.JOptionPane

            Dimension dim = textArea.getPreferredSize();
            dim.height = dim.width*50/80;
            scrollPane.setPreferredSize(dim);

            // pass the scrollpane to the joptionpane.
            JDialog dialog = new JOptionPane(scrollPane, JOptionPane.PLAIN_MESSAGE).
                    createDialog(this, "README");
            dialog.setResizable(true);
            dialog.setModalityType(ModalityType.MODELESS);
            dialog.setVisible(true);
        } catch (Exception ex) {
View Full Code Here

Examples of javax.swing.JOptionPane

                }
            }
        });

        // pass the scrollpane to the joptionpane.
        JDialog dialog = new JOptionPane(textPane, JOptionPane.PLAIN_MESSAGE).
                createDialog(this, "About");

        if (UIManager.getLookAndFeel().getClass().getName()
                .equals("com.sun.java.swing.plaf.gtk.GTKLookAndFeel")) {
            // under GTK, frameBackground is white, but rootPane color is OK...
View Full Code Here

Examples of javax.swing.JOptionPane

            Dimension dim = textArea.getPreferredSize();
            dim.height = dim.width*50/80;
            scrollPane.setPreferredSize(dim);

            // pass the scrollpane to the joptionpane.
            JDialog dialog = new JOptionPane(scrollPane, JOptionPane.PLAIN_MESSAGE).
                    createDialog(this, "README");
            dialog.setResizable(true);
            dialog.setModalityType(ModalityType.MODELESS);
            dialog.setVisible(true);
        } catch (Exception ex) {
View Full Code Here

Examples of javax.swing.JOptionPane

                }
            }
        });

        // pass the scrollpane to the joptionpane.
        JDialog dialog = new JOptionPane(textPane, JOptionPane.PLAIN_MESSAGE).
                createDialog(this, "About");

        if (UIManager.getLookAndFeel().getClass().getName()
                .equals("com.sun.java.swing.plaf.gtk.GTKLookAndFeel")) {
            // under GTK, frameBackground is white, but rootPane color is OK...
View Full Code Here

Examples of javax.swing.JOptionPane

    {}
   
    public static String showPasswordDialog(Component parent, String title, int passFields, int icon)
    {
        final JPasswordField passwordField = new JPasswordField(passFields);
        JOptionPane pane = new JOptionPane(passwordField, icon, JOptionPane.OK_CANCEL_OPTION);
        JDialog dia = pane.createDialog(parent, title);
        dia.addWindowListener(new WindowAdapter()
        {
            @Override
            public void windowActivated(WindowEvent ev)
            {
                Timer timer = new Timer(50, new ActionListener()
                {
                    public void actionPerformed(ActionEvent ev)
                    {
                       passwordField.requestFocusInWindow();
                    }
                });
                timer.setRepeats(false);
                timer.start();
            }
        });

        dia.setVisible(true);
        return ((Integer)pane.getValue() == JOptionPane.OK_OPTION ? new String (passwordField.getPassword()) : null);
    }
View Full Code Here

Examples of javax.swing.JOptionPane

      message = "MEAPsoft has encountered a fatal error: " + message;

    //if(message.length() > 70)
    //    message = message.substring(0, 70);
     
    final JOptionPane optionPane =
      new JOptionPane(message, JOptionPane.QUESTION_MESSAGE);

    final JDialog dialog = new JDialog(jframe, "Exception!", 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()
View Full Code Here

Examples of javax.swing.JOptionPane

      message = "MEAPsoft has encountered a fatal error: " + message;

    //if(message.length() > 70)
    //    message = message.substring(0, 70);
     
    final JOptionPane optionPane =
      new JOptionPane(message, JOptionPane.QUESTION_MESSAGE);

    final JDialog dialog = new JDialog(jframe, "Exception!", 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()
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.