1 package hero.client.grapheditor; 2 3 import javax.swing.*; 4 import java.awt.*; 5 import java.awt.event.*; 6 7 8 public class SplashWindow extends JWindow 9 { 10 11 public SplashWindow( java.awt.Frame f,Frame frame ) 12 { 13 14 super(f); 15 try{ 16 String filename="images/open.gif"; 17 int waitTime=5; 18 ClassLoader cl = frame.getClass().getClassLoader(); 19 JLabel l = new JLabel(new ImageIcon(cl.getResource("images/Splash.gif"))); 20 getContentPane().add(l, BorderLayout.CENTER); 21 pack(); 22 Dimension screenSize = 23 Toolkit.getDefaultToolkit().getScreenSize(); 24 Dimension labelSize = l.getPreferredSize(); 25 setLocation(screenSize.width/2 - (labelSize.width/2), 26 screenSize.height/2 - (labelSize.height/2)); 27 addMouseListener(new MouseAdapter() 28 { 29 public void mousePressed(MouseEvent e) 30 { 31 setVisible(false); 32 dispose(); 33 } 34 }); 35 62 setVisible(true); 63 }catch(Exception ex){ex.printStackTrace();} 66 } 67 } 68 | Popular Tags |