[java] Communicating between subclass and parent

Started by
2 comments, last by eedok 20 years, 6 months ago
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?
Advertisement
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....
garazdawi - 'I put the laughter back in slaughter'
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..
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
"None of us learn in a vacuum; we all stand on the shoulders of giants such as Wirth and Knuth and thousands of others. Lend your shoulders to building the future!" - Michael Abrash[JavaGaming.org][The Java Tutorial][Slick][LWJGL][LWJGL Tutorials for NeHe][LWJGL Wiki][jMonkey Engine]

This topic is closed to new replies.

Advertisement