0
public GuiPrototypeScreen1() {
        GuiPrototypeScreen1Layout customLayout = new GuiPrototypeScreen1Layout();

        Object[] possibleValues = { "Search", "Contribute" };
        Object selectedValue = JOptionPane.showInputDialog(null,
        "Do you want to ", "Welcome",
        JOptionPane.INFORMATION_MESSAGE, null,
        possibleValues, possibleValues[0]);

Hey guys
i need help because i am completly stuck. All i want is when a string is selected to redirect me to another Gui. I have no clue how Action listeners work on JOptionPane

Thanks in advance

Edited by nickmi: n/a

4
Contributors
4
Replies
5
Views
6 Years
Discussion Span
Last Post by mKorbel
1

All i want is when a string is selected to redirect me to another Gui.

You could test what is returned by the showInputDialog method to select the other GUI.

0

Check which button the user clicked on, then create your new JFrame and call .setVisible(true) on it.

Edited by leiger: n/a

0

i am still not sure what to do guys! i am a beginner in java

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.