[java] Communicating between subclass and parent
Hello, for my level editor(when you hit the new level button), I want it to come up with a dialog that has the things the person wants to specify, and when they click the OK button it''ll send the parameters back to the parent and close the dialog. I''m wondering on how this is to be done, because I made the dialog with the dialog editor in NetBeans and I know it can read and write within itself just fine, but how would I make it send the values to the parent?
I think the class you want to look at is called JOptionPane. It might not be exactly be what you want but it does what you describe that you want to be done. You can call something like
String temp= JOptionPane.showOptionPane(....);
and that should do it..... you can congigure the optionpane with the params... read the doc for more details as to how....
String temp= JOptionPane.showOptionPane(....);
and that should do it..... you can congigure the optionpane with the params... read the doc for more details as to how....
I just came here to delete this post cause I got it, but might as well say what I did..
I just made it so when they hit OK, it takes the text boxes and sets them to public global variables, which the parent then reads..
I just made it so when they hit OK, it takes the text boxes and sets them to public global variables, which the parent then reads..
In a game environment, that is exactly what you want to do. In a normal app, you can make accessor methods to get the answers.
First make it work,
then make it fast.
--Brian Kernighan
The problems of this world cannot possibly be solved by skeptics or cynics whose horizons are limited by the obvious realities. We need men and women who can dream of things that never were. - John Fitzgerald Kennedy(35th US President)
Do not interrupt your enemy when he is making a mistake. - Napolean Bonaparte
First make it work,
then make it fast.
--Brian Kernighan
The problems of this world cannot possibly be solved by skeptics or cynics whose horizons are limited by the obvious realities. We need men and women who can dream of things that never were. - John Fitzgerald Kennedy(35th US President)
Do not interrupt your enemy when he is making a mistake. - Napolean Bonaparte
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement