i would like to ask for further information and suggestion about this problem.
I am making an JApplet and I want to put a splash screen. I used JWindow. In the JWindow I put a JLabel...just a simple label so as to know if the label would appear in the JWindow. Unfortunately, the jlabel did not appear. I tried it as a simple application and it works. Here is my code for the splash screen. `
try{
javax.swing.JWindow window = new javax.swing.JWindow(); window.setBackground(Color.YELLOW); window.setLayout(new FlowLayout()); window.add(new JLabel("twintwins")); window.setSize(200, 200); window.setVisible(true);  开发者_运维百科;Thread.sleep(5000); window.dispose(); } catch(Exception err){ JOptionPane.showMessageDialog(null, err.toString()); }`
Please help. Thanks.
Me and my colleague already solved this issue. Well, it has been discovered that the line
Thread.sleep(5000);
did the problem. It is unsafe to use threads in applets (I guess). That is why it is recommended that if you will use threads in applets, make sure to instantiate a thread and that instantiated thread will be used and not other running threads in your applet. Thanks ultrajohn for helping!
精彩评论