Article View: borland.public.jbuilder.java.swing
Article #125What's wrong with this code?
From: tom
Date: Tue, 14 Feb 2006 22:31
Date: Tue, 14 Feb 2006 22:31
70 lines
2778 bytes
2778 bytes
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();
}
});
}
Technical Details
Message-ID:
<43f25946$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news.glorb.com!news2.volia.net!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Thread: 111d45,2a904e9473ce8441,start X-Google-Attributes: gid111d45,public X-Google-Language: ENGLISH,ASCII-7-bit Reply-To: "tom" <zhangx@gaia.ecs.csus.edu> From: "tom" <zhangx@gaia.ecs.csus.edu> Newsgroups: borland.public.jbuilder.java.swing Subject: What's wrong with this code? Date: Tue, 14 Feb 2006 14:31:30 -0800 Lines: 72 Organization: java developer beginner X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.2527 X-RFC2646: Format=Flowed; Original X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2527 NNTP-Posting-Host: 136.200.198.187 Message-ID: <43f25946$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1139956038 136.200.198.187 (14 Feb 2006 14:27:18 -0700) Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news.glorb.com!news2.volia.net!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail