1 2 3 package org.webdocwf.util.loader.wizard; 4 5 import java.awt.*; 6 import javax.swing.*; 7 import java.awt.event.*; 8 9 10 public class OctopusSplash extends JWindow { 11 private static OctopusSplash octopusSplash; 12 13 public OctopusSplash(String icon, JFrame f) { 14 super(f); 15 String prefixUrl="org/webdocwf/util/loader/"+ 16 "wizard/images/"; 17 JLabel l = new JLabel(new ImageIcon( 18 getClass().getClassLoader().getResource(prefixUrl+icon))); 19 getContentPane().add(l, BorderLayout.CENTER); 20 21 Dimension dimension = Toolkit.getDefaultToolkit().getScreenSize(); 22 setBounds((dimension.width-281)/2,(dimension.height-210)/2,281,210); 23 setVisible(true); 24 25 addMouseListener(new MouseAdapter() { 26 public void mousePressed(MouseEvent e) { 27 hideSplash(); 28 } 29 }); 30 setVisible(true); 31 octopusSplash=this; 32 } 33 34 public static OctopusSplash getSplash () { 35 return octopusSplash; 36 } 37 38 public void hideSplash () { 39 if (isVisible()) { 40 setVisible(false); 41 dispose(); 42 } 43 } 44 45 } 46 47 | Popular Tags |