🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.swing
Article #351

Re: how can I display the output from system.out.println message to JDialog?

#351
From: Alexey N. Solofnenko
Date: Wed, 31 Aug 2005 00:46
55 lines
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/
Technical Details
Message-ID: <4314fdc7$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news.glorb.com!wns13feed!worldnet.att.net!207.115.63.142!newscon02.news.prodigy.com!newscon06.news.prodigy.com!prodigy.net!news-FFM2.ecrc.net!newsfeed00.sul.t-online.de!t-online.de!195.92.193.196.MISMATCH!nntp.theplanet.net!inewsm1.nntp.theplanet.net!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mail
References: <4314f5e4$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 111d45,ede56a718ac43510
X-Google-Attributes: gid111d45,public
X-Google-Language: ENGLISH,ASCII-7-bit
Date: Tue, 30 Aug 2005 17:46:44 -0700
From: "Alexey N. Solofnenko" <trelony@mail.ru>
User-Agent: Thunderbird 1.0+ (Windows/20050830)
MIME-Version: 1.0
Newsgroups: borland.public.jbuilder.java.swing
Subject: Re: how can I display the output   from system.out.println message
 to JDialog?
References: <4314f5e4$1@newsgroups.borland.com>
In-Reply-To: <4314f5e4$1@newsgroups.borland.com>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 208.200.221.5
Message-ID: <4314fdc7$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1125449159 208.200.221.5 (30 Aug 2005 17:45:59 -0700)
Lines: 55
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news.glorb.com!wns13feed!worldnet.att.net!207.115.63.142!newscon02.news.prodigy.com!newscon06.news.prodigy.com!prodigy.net!news-FFM2.ecrc.net!newsfeed00.sul.t-online.de!t-online.de!195.92.193.196.MISMATCH!nntp.theplanet.net!inewsm1.nntp.theplanet.net!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mail