Package javax.swing

Examples of javax.swing.JOptionPane


* @author Alex Ruiz
*/
public class JOptionPaneDriver_buttonWithTextAsPattern_Test extends JOptionPaneDriver_TestCase {
  @Test
  public void should_find_button_with_text_matching_pattern() {
    JOptionPane optionPane = messageWithOptions("First", "Second");
    launch(optionPane, title());
    JButton button = driver.buttonWithText(optionPane, Pattern.compile("Sec.*"));
    assertThat(textOf(button)).isEqualTo("Second");
  }
View Full Code Here


* @author Alex Ruiz
*/
public class JOptionPaneDriver_requireWarningMessage_Test extends JOptionPaneDriver_TestCase {
  @Test
  public void should_pass_if_error_type_is_equal_to_expected() {
    JOptionPane optionPane = warningMessage();
    pack(optionPane, title());
    driver.requireWarningMessage(optionPane);
  }
View Full Code Here

    return messageOfType(WARNING_MESSAGE);
  }

  @Test
  public void should_fail_if_error_type_is_not_equal_to_expected() {
    JOptionPane optionPane = errorMessage();
    pack(optionPane, title());
    try {
      driver.requireWarningMessage(optionPane);
      failWhenExpectingException();
    } catch (AssertionError e) {
View Full Code Here

* @author Alex Ruiz
*/
public class JOptionPaneDriver_requireQuestionMessage_Test extends JOptionPaneDriver_TestCase {
  @Test
  public void should_pass_if_error_type_is_equal_to_expected() {
    JOptionPane optionPane = questionMessage();
    pack(optionPane, title());
    driver.requireQuestionMessage(optionPane);
  }
View Full Code Here

    return messageOfType(QUESTION_MESSAGE);
  }

  @Test
  public void should_fail_if_error_type_is_not_equal_to_expected() {
    JOptionPane optionPane = errorMessage();
    pack(optionPane, title());
    try {
      driver.requireQuestionMessage(optionPane);
      failWhenExpectingException();
    } catch (AssertionError e) {
View Full Code Here

  @Override
  public void voiceRequest(VoiceConnexionPacket clp) {
    c.getVerbose().addConsoleMsg("MainView.voiceRequest()", EnumSet.of(EnumVerbose.ToConsole));
    // notice user who want to talk with you
    final JOptionPane optionPane = new JOptionPane("Do you want to talk with : " + clp.getContactName(), JOptionPane.QUESTION_MESSAGE, JOptionPane.YES_NO_OPTION);
    final JDialog dialog = new JDialog(this, "Incoming Call ... ", true);

    dialog.setContentPane(optionPane);

    // listener for user response user
    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);
        }
      }
    });

    // afficher le dialogue
    dialog.pack();
    dialog.setVisible(true);

    // if yes, contact user
    int value = ((Integer) optionPane.getValue()).intValue();
    if (value == JOptionPane.YES_OPTION) {
      new ConfirmVoiceAction(c, clp.getUserIp(), new VoiceConnexionPacket(me.getUsername(), me.getIp(), clp.getUsername()));
      getContactListHash().get(clp.getUsername()).swapChat(true);
    } else {
      // if no, ignore demands
View Full Code Here

        // Display a dialog showing a wait message while we import. We need
        // to do this in the SwingWorker thread so it gets drawn
        String msg = MessageFormat.format(
                BUNDLE.getString("Please_Wait_Message"), file.getName());
        String title = BUNDLE.getString("Please_Wait_Title");
        JOptionPane waitMsg = new JOptionPane(msg);
        final JDialog dialog = waitMsg.createDialog(frame, title);
        SwingUtilities.invokeLater(new Runnable() {

            public void run() {
                dialog.setVisible(true);
            }
View Full Code Here

        reconnectThread = new Thread(this, "Reconnect to server");
        reconnectThread.start();
    }

    private void initComponents() {
        reconnectPane = new JOptionPane(
                BUNDLE.getString("ATTEMPTING_TO_RECONNECT..."),
                JOptionPane.WARNING_MESSAGE, JOptionPane.DEFAULT_OPTION);
        reconnectDialog = reconnectPane.createDialog(
                JmeClientMain.getFrame().getFrame(),
                BUNDLE.getString("SERVER_DISCONNECTED"));
View Full Code Here

    if (!(mainView.getSelectedUser() == null)) {
      String msg = new String("Are you sure you want to delete " + mainView.getSelectedUser().getUsername() + "\n" + "from your contact list ?");

      // confirm to erase panels
      final JOptionPane optionPane = new JOptionPane(msg, JOptionPane.QUESTION_MESSAGE, JOptionPane.YES_NO_OPTION);
      final JDialog dialog = new JDialog(mainView, "Click a button", true);

      dialog.setContentPane(optionPane);

      // listener for user response user
      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);
          }
        }
      });

      // afficher le dialogue
      dialog.pack();
      dialog.setVisible(true);

      // if yes, erase user
      int value = ((Integer) optionPane.getValue()).intValue();
      if (value == JOptionPane.YES_OPTION) {

        ClientRequestPacket p = new ClientRequestPacket(mainView.getMe().getUsername(), mainView.getSelectedUser().getUsername());
        new RemoveContactAction(c, p);
      }
View Full Code Here

        JOptionPane.showMessageDialog(null, messages.getString("update.updateCheckFailed.message"), messages.getString("update.updateCheckFailed.title"), JOptionPane.WARNING_MESSAGE);
      }
    });
    if (ecUpdater.isUpdateAvailable())
    {
      JOptionPane pane = new JOptionPane(messages.getString("update.updateAvailable.message"));
      String yes = messages.getString("update.updateAvailable.yes");
      String no = messages.getString("update.updateAvailable.no");
      pane.setOptions(new String[] { yes, no });
      JDialog dialog = pane.createDialog(new JFrame(), messages.getString("update.updateAvailable.title", ecUpdater.getLatestVersion()));
      dialog.setVisible(true);

      Object selection = pane.getValue();

      if (selection.equals(yes))
      {
        JFrame updateFrame = new JFrame();
        updateFrame.setTitle(messages.getString("update.updating.title"));
View Full Code Here

TOP

Related Classes of javax.swing.JOptionPane

Copyright © 2018 www.massapicom. 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.