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

Recommended Answers

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.

Jump to Post

All 4 Replies

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.

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

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

please read tutorial and if you will be real question then ask ...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.