0

Hi,

Im developing a game. When the human gets his turn i want to display a JFrame with some buttons.
So the game must wait until the user clicks on a button. Also i want to identify which button is clicked.

I read that JOptionPna gets any component as a parameter.I did the following.
but the coding of the my object is shown inside an input field.

 MyFrame my=new MyFrame();
 JOptionPane.showInputDialog(null,"test",my);

PLZ....... help me

3
Contributors
2
Replies
3
Views
5 Years
Discussion Span
Last Post by Taios
0

Do you want it as a JFrame or just a simple quick option selection pane?

Just a quick snippet I took because I cba looking up Java doc stuff:

 static String[] connectionOptions = {"Real server", "Fake server", "Simulation server"};
 String input = (String) JOptionPane.showInputDialog(null, "Choose option","Connection selection", JOptionPane.QUESTION_MESSAGE, null, connectionOptions, connectionOptions[0]);

That would return an option selected from a drop down box. So if 'Real server' was selected the string would be 'Real server' etc.

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.