vendredi 10 juin 2016

How do I use the information from an option pane in an if statement

I'm trying to figure out how to assign a name/title to the options used in an option pane so that I can use them in an if-statement. Here's the code I have so far:

int i = 0;
while(i<1){
        JFrame frame = new JFrame();
            String[] options = new String[2];
            options[0] = new String("Peat");
            options[1] = new String("Repeat");
            JOptionPane.showOptionDialog(frame.getContentPane(),"Peat and Repeat were walking on a bridge\nPeat fell off, "
                    + "who was left?","", 0,JOptionPane.INFORMATION_MESSAGE,null,options,null);
    }

What would you recommend I do next to finish this "joke"?

Aucun commentaire:

Enregistrer un commentaire