Thread View: borland.public.jbuilder.java.swing
2 messages
2 total messages
Started by tom
Wed, 31 Aug 2005 00:13
how can I display the output from system.out.println message to JDialog?
Author: tom
Date: Wed, 31 Aug 2005 00:13
Date: Wed, 31 Aug 2005 00:13
35 lines
2071 bytes
2071 bytes
Hi,
I don't what would be the best approach to my problem.
I have a routine that populate user data into oracle table. This operates is
quite lenghty. I want to show
what's happening as the data is being inserted into the table.
Is there a way to direct the output of the system.out.println("") to Jdialog
as a popup window to show the user what's being inserted?
code snip:
..
JDialog jwin = new JDialog();
String statusTitle = "Populating initial data... please wait...";
jwin.setTitle(statusTitle);
jwin.setResizable(true);
jwin.setBackground(Color.lightGray);
jwin.setBounds(50, 50, 400, 400);
jwin.setVisible(true);
...
try {
...
while (rset.next()) {
//print each row
System.out.println(rset.getString(1) + " " + rset.getString(2) + " " +
rset.getString(3) + " " + rset.getString(4) + " " +rset.getString(5));
}
} catch (SQLException ex) {
}
Thanks,
Tom
Re: how can I display the output from system.out.println message to JDialog?
Author: Alexey N. Solofnenko
Date: Wed, 31 Aug 2005 00:46
Date: Wed, 31 Aug 2005 00:46
55 lines
2655 bytes
2655 bytes
I would create an interface like (maybe with percentage, if you need to
change a progress bar):
public interface Progress {
void changeStatus(String msg);
}
Then create an implementation in your dialog. Since the interface will
be called from another thread, do not modify the dialog directly, but
from invokeLater().
- Alexey.
tom wrote:
> Hi,
>
> I don't what would be the best approach to my problem.
>
> I have a routine that populate user data into oracle table. This operates is
> quite lenghty. I want to show
> what's happening as the data is being inserted into the table.
>
> Is there a way to direct the output of the system.out.println("") to Jdialog
> as a popup window to show the user what's being inserted?
>
> code snip:
> ..
> JDialog jwin = new JDialog();
> String statusTitle = "Populating initial data... please wait...";
> jwin.setTitle(statusTitle);
> jwin.setResizable(true);
> jwin.setBackground(Color.lightGray);
> jwin.setBounds(50, 50, 400, 400);
> jwin.setVisible(true);
> ...
> try {
> ...
> while (rset.next()) {
> //print each row
> System.out.println(rset.getString(1) + " " + rset.getString(2) + " " +
> rset.getString(3) + " " + rset.getString(4) + " " +rset.getString(5));
> }
>
> } catch (SQLException ex) {
> }
> Thanks,
>
>
> Tom
>
>
--
Alexey N. Solofnenko {trelony at gmail.com}
home: http://trelony.cjb.net/
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads