Article View: borland.public.jbuilder.java.swing
Article #116Re: loading screen for Java application
From: Ian Mills
Date: Sat, 11 Feb 2006 10:51
Date: Sat, 11 Feb 2006 10:51
88 lines
3977 bytes
3977 bytes
tom wrote:
> Hi Paul,
>
> Thanks for your suggestion. I do not need a progress dialog. I just want to
> use a real simple splash screen to display some text while the java
> application is loading.
> I tried JDialog and JWindow; however, I can not get the text to display on
> the contentPane unless I set the setModal to true, which it's kind of
> defeating the purpose.
>
> Once I set the setModal to true, it takes over the current process thread.
> It will not continue until I manuall close the dialog.
>
> Am I missing something here? Please take a look at the following code snip.
>
>
> thanks,
>
> Tom
>
> code snip:
>
> String status = "Loading... Please wait...";
> JDialog jwin = new JDialog();
> JPanel jpanel = new JPanel();
> jpanel.add(
> new JLabel("Now Loading...",
> SwingConstants.CENTER));
>
> jpanel.setVisible(true);
> jwin.getContentPane().add(jpanel, BorderLayout.CENTER);
>
>
> //jwin.setModal(true); /* visible only if enabled */
> jwin.setTitle(status);
> jwin.setResizable(false);
> jwin.setBackground(Color.lightGray);
> jwin.setBounds(400, 400, 250, 1
>
> //Loading application here...
> jwin.setVisible(false);
> jwin.dispose();
>
> "Paul Furbacher [TeamB]" <pfurbacher@mac.com> wrote in message
> news:43e81693$1@newsgroups.borland.com...
>
>>tom wrote:
>>
>>
>>>Does anyone know how to create 'build progress' screen similar to
>>>Jbuilder uses when it compiles/makes the application? It displays a
>>>JDialog with compiling messages and closed after finished compiling the
>>>application.
>>
>>The following article may provide insight:
>>
>> http://java.sun.com/products/jfc/tsc/articles/threads/threads2.html
>>
>>I'm sure there are other examples; try Googling
>>
>> swing worker thread examples progress dialog
>>
>>Here's one hit:
>>
>>
>>http://java.sun.com/docs/books/tutorial/uiswing/components/progress.html
>>
>>
>>--
>>
>>
>>Paul Furbacher (TeamB)
>>
>> Save time, search the archives:
>> http://info.borland.com/newsgroups/ngsearch.html
>>
>> Is it in Joi Ellis's Faq-O-Matic?
>> http://www.visi.com/~gyles19/fom-serve/cache/1.html
>>
>> Finally, please send responses to the newsgroup only.
>> That means, do not send email directly to me.
>> Thank you.
>
>
>
I think you probably need to set your dialog visible and not the JPanel.
i.e. jwin.setVisible(true) after adding the JPanel.
Technical Details
Message-ID:
<43edc1c8$0$82664$ed2619ec@ptn-nntp-reader03.plus.net>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news2.volia.net!newsfeed01.sul.t-online.de!t-online.de!newsfeed.cw.net!cw.net!news-FFM2.ecrc.de!newsfeed.icl.net!proxad.net!proxad.net!news.clara.net!wagner.news.clara.net!nntp-peering.plus.net!ptn-nntp-feeder03.plus.net!ptn-nntp-spool01.plus.net!ptn-nntp-reader03.plus.net!not-for-mailReferences:
<43e7dbf3@newsgroups.borland.com> <43e81693$1@newsgroups.borland.com> <43e93e25$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 111d45,3d616149f9b71a58 X-Google-Attributes: gid111d45,public X-Google-Language: ENGLISH,ASCII-7-bit Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news2.volia.net!newsfeed01.sul.t-online.de!t-online.de!newsfeed.cw.net!cw.net!news-FFM2.ecrc.de!newsfeed.icl.net!proxad.net!proxad.net!news.clara.net!wagner.news.clara.net!nntp-peering.plus.net!ptn-nntp-feeder03.plus.net!ptn-nntp-spool01.plus.net!ptn-nntp-reader03.plus.net!not-for-mail Date: Sat, 11 Feb 2006 10:51:41 +0000 From: Ian Mills <news@siteone.free-online.co.uk> User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.12) Gecko/20050915 X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: borland.public.jbuilder.java.swing Subject: Re: loading screen for Java application References: <43e7dbf3@newsgroups.borland.com> <43e81693$1@newsgroups.borland.com> <43e93e25$1@newsgroups.borland.com> In-Reply-To: <43e93e25$1@newsgroups.borland.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Lines: 88 Message-ID: <43edc1c8$0$82664$ed2619ec@ptn-nntp-reader03.plus.net> Organization: Customer of PlusNet plc (http://www.plus.net) NNTP-Posting-Host: de36f5ee.ptn-nntp-reader03.plus.net X-Trace: DXC=Y;AP[j]Nd<:Qbc<=nn=;a6igd3Y`7Rb;>@`8gV4CC7I7[;]E95Pbji<7fnh[PJFMN>Ul8`=ZNBT32Y[nmRIOd<46 X-Complaints-To: abuse@plus.net