0

I am using a JOptionPane to get a string. By klicking "OK" the string is saved. Now i want the second JOptionPane to pop-up to enter the second necassary string. Is there any opportunity to add an ActionListener to the "Ok"-button from the first JOptionPane? Or what is the best solution of my problem? I also checked the docs, but did not found something useful yet.

My JOptionPanes lool nearly similar.

mKorbel
  • 109,525
  • 20
  • 134
  • 319
Yannic Hansen
  • 235
  • 3
  • 17

1 Answers1

1

The simple way for me is just combining it with Confirmation Dialog !

import javax.swing.JOptionPane;

public class ConfirmDialog
 {
    public static void main (String args []){


    int choose= JOptionPane.showConfirmDialog(null, "Open Dialog  ??");

    if(choose== JOptionPane.YES_OPTION) {
        JOptionPane.showMessageDialog(null,"You Clicked Yes !!");
    } else if(choose== JOptionPane.NO_OPTION) {
                JOptionPane.showMessageDialog(null,"You Clicked NO");
    }
        }
         }
Fevly Pallar
  • 3,059
  • 2
  • 15
  • 19