By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,468 Members | 1,865 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,468 IT Pros & Developers. It's quick & easy.

JFrame execution from a console Java application

P: n/a
I'm relatively new to Java Swing programming. I have a console application
that processes text files and while doing so I want to suspend the execution
when an error is encountered that requires the user to make a choice. I want
to do that with my own JFrame that allows the user to edit the bad data in a
GUI and then click "Accept" or "Ignore". If the user clicks "Accept", the
JFrame contributes the data to the standard output being generated by the
console application; otherwise it just leaves it out.

My problem is that when I create the JFrame from my console application and
call the frame's show() method, program execution does not block. I want the
program to stop until the user closes the JFrame.

Is this possible, and if so, how?

-tuno
Jul 17 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
On Thu, 24 Jun 2004 16:49:21 +0000, Tuno wrote:
I'm relatively new to Java Swing programming. I have a console application
that processes text files and while doing so I want to suspend the execution
when an error is encountered that requires the user to make a choice. I want
to do that with my own JFrame that allows the user to edit the bad data in a
GUI and then click "Accept" or "Ignore". If the user clicks "Accept", the
JFrame contributes the data to the standard output being generated by the
console application; otherwise it just leaves it out.

My problem is that when I create the JFrame from my console application and
call the frame's show() method, program execution does not block. I want the
program to stop until the user closes the JFrame.

Is this possible, and if so, how?

-tuno


You may want a modal dialog (javax.swing.JDialog). But you might really
want to use System.in to get the user's response, and System.out to
display it, instead, so that the console application remains a console
application. GUIs don't work terribly well over remote shells, etc., and
they're not nearly as easily-scriptable.

--
Some say the Wired doesn't have political borders like the real world,
but there are far too many nonsense-spouting anarchists or idiots who
think that pranks are a revolution.

Jul 17 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.