31 March 2007 - java_dev (original) (raw)

Hey! I'm currently doing a Java assignment at my university, but it's spring break and I'm stuck. I have a couple of questions that I'm sure are newbie questions. Don't be mad!

Okay. I'm making a GUI right now, and we're supposed to run the GUI in its own (the event dispatch?) thread. As far as I've gathered, that's achieved with an anonymous class like so:

SwingUtilities.invokeLater(new Runnable() { public void run() { new SomeWindow(); } });

Correct? Is this what I want to do every time I open a dialog from the main thread, like simple JOptionPanes and stuff (but if I were to open one from a window I already opened in the first way, that wouldn't be needed, or would it?)?

Okay, so here's my main question. When I've run the statement above, is there any way I can tell the SomeWindow (arbitrary name, of course) I've created to do something from the main thread? ( Specifically ...Collapse )

Thanks for any and all help!