When I use JOptionPane.showInputDialog() the input dialog pops up behind any other windows on the screen at the time. Anyone know how to fix that? Not a huge problem but its irritating.
String list[] = {"100","400","900","1600"};
String value = null;
while(value == null)
{
value = (String)JOptionPane.showInputDialog(null,"How many cells do you want?",
"John Conway's Game Of Life",JOptionPane.INFORMATION_MESSAGE,null,list,list[1]);
if (value == null)
JOptionPane.showMessageDialog(null,"You must choose a number.",
"ERROR",JOptionPane.ERROR_MESSAGE);
}
This is the section of code that the input dialog is in. Do you think that it could possibly have something to do with the IDE? I had this problem when programming in highschool as well.
incompatible types - found java.lang.Object but expected java.lang.String
Still trying to figure that one out because I have never seen a showInputDialog() method that returns an object. Type casting is a remedy for now but still looking for why it needs it. Maybe it has something to do with using a list in the dialog.
I was wrong, I finally got the docs to load up on this slow college net and found that it does in fact return an object. Thanks for reminding me to look that one up though, I had forgotten about that issue and now I get it.
I need to create an InputDialog using JOptionPane with two input fields an a large information message. How can I do this? Or may be it's better to create a JDialog?
Sounds like you will be using a JFrame or JPanel. Have you worked with either of these yet? The input won't be hard once you get the actual window working.
__________________
||||If you are getting paid to do a job, don't ask for help on it!||||