🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: What's wrong with this code?

#126
From: Lori M Olson [TeamB]
Date: Tue, 14 Feb 2006 23:56
99 lines
3732 bytes
tom wrote:
> Hi,
> 
> Could someone please tell me what's wrong with the following code?
> I tried to run the splash screen on a seperate thread, but it will only show 
> up after the main thread is finished.
> Is there a way to allow the two thread starting at the same time?
> 
> Any suggestion will be appreciated.
> 
> Thanks,
> 
> Tom
> 
> here is my code snip.
> 
> ....
>   public static void main(String[] args) {
> 
>     SwingUtilities.invokeLater(new Runnable() {
>        public void run() {
>         try {
>            UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
>                    }
>         catch (Exception exception) {
>           exception.printStackTrace();
>         }
> 
>             Runnable runner = new Runnable() {
>              public void run() {
>             try {
>               Thread.sleep(1000);
>                 }catch (InterruptedException e){}
> 
>             validate_users();
> 
>             String status = "Loading... Please wait...";
>              JDialog jwin = new JDialog();
> 
>             JLabel l = new JLabel();
>             JPanel jpanel = new JPanel();
> 
>             l.setText("Now Loading...");
>             l.setIcon(image3);
>             l.setVisible(true);
>             jpanel.add(
>                 new JLabel("Now Loading...",
>                            SwingConstants.CENTER));
> 
>             jpanel.setVisible(true);
>             jwin.getContentPane().add(jpanel, BorderLayout.CENTER);
> 
>             jwin.setTitle(status);
>             jwin.setResizable(false);
>             //jwin.setModal(true);
>             jwin.setBackground(Color.lightGray);
>             jwin.setBounds(400, 400, 250, 150);
>             jwin.setVisible(true);
>             jwin.repaint();
> 
>                    }
> 
>                  };
>                   EventQueue.invokeLater(runner);
> 
>               new Appilcation();
>            }
> 
>     });
> 
> } 
> 
> 

Googling for - swing splash thread

Yields:

http://www.javaworld.com/javaworld/javatips/jw-javatip104.html


-- 

Regards,

Lori Olson [TeamB]

------------

Save yourself, and everyone else, some time and search the
newsgroups and the FAQ-O-Matic before posting your next
question.

Google Advanced Newsgroup Search
     http://www.google.ca/advanced_group_search
Other Newsgroup Searches:
     http://www.borland.com/newsgroups/ngsearch.html
Joi Ellis's FAQ-O-Matic:
     http://www.visi.com/~gyles19/fom-serve/cache/1.html
Technical Details
Message-ID: <43f26d3c$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news4.google.com!news.glorb.com!news-in.ntli.net!newsrout1-win.ntli.net!ntli.net!news.highwinds-media.com!nntp.theplanet.net!inewsm1.nntp.theplanet.net!newsfeed.icl.net!newsfeed.fjserv.net!oleane.net!oleane!grolier!194.74.65.66.MISMATCH!news-peer0-test!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mail
References: <43f25946$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 111d45,2a904e9473ce8441
X-Google-Attributes: gid111d45,public
X-Google-Language: ENGLISH,ASCII-7-bit
Date: Tue, 14 Feb 2006 16:56:32 -0700
From: "Lori M Olson [TeamB]" <javadragon@techie.com>
User-Agent: Thunderbird 1.5 (Macintosh/20051201)
MIME-Version: 1.0
Newsgroups: borland.public.jbuilder.java.swing
Subject: Re: What's wrong with this code?
References: <43f25946$1@newsgroups.borland.com>
In-Reply-To: <43f25946$1@newsgroups.borland.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 142.179.182.172
Message-ID: <43f26d3c$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1139961148 142.179.182.172 (14 Feb 2006 15:52:28 -0700)
Lines: 99
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news4.google.com!news.glorb.com!news-in.ntli.net!newsrout1-win.ntli.net!ntli.net!news.highwinds-media.com!nntp.theplanet.net!inewsm1.nntp.theplanet.net!newsfeed.icl.net!newsfeed.fjserv.net!oleane.net!oleane!grolier!194.74.65.66.MISMATCH!news-peer0-test!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mail