jeudi 20 avril 2017

how do I place an if statement after a selection if made from dropdown

I have two dropdowns that I am trying to utilize after they are selected I want another box to pop up based on the selection to display information. When I try to use an if statement and press the okay button it just continues on to the next line. I started with a showmessagedialog but I want to display a warning in some of the dropdown options. It isn't working. I also need to be able to loop back to the main menu so that they can make a different selection.

example of what I have now

 int x = JOptionPane.showOptionDialog(null, "Zookeepers would you like to     view animal activities or monitor habitats?",
            "Welcome to the Brooklyn Zoo!",         JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE, icon,     options,     options[0]);
System.out.println(x);  



if(x==0){  

String[] choices = {"Lions","Tigers","Bears","Giraffes",};
String input = (String) JOptionPane.showInputDialog(null,"Select     Animal:","Zoo Animals",
JOptionPane.QUESTION_MESSAGE,null,choices,choices[1]);


if (choices.equals("Lions"));
String [] button = {"OK","Cancel","Warning"};
JOptionPane.showOptionDialog(null, "\"Animal: Lion\\nName: Leo\\nAge: 5    \\nFeeding Schedule: Twice daily\\n\\nALERT: Cut on left front paw",
    "Animal",JOptionPane.YES_NO_CANCEL_OPTION,JOptionPane.WARNING_MESSAGE,     options, options [0]);

Aucun commentaire:

Enregistrer un commentaire