nessuno?
comunque questo è il codice con il quale ho creato lo splashScreen
codice:public class SplashScreen extends JWindow { private static final String path = "Tetris_Attack.png"; private ImageIcon icon; private JLabel image; private JLabel titleLbl; private JPanel panel; private static JProgressBar prog; public SplashScreen(){ this.setSize(506,516); this.setLocation(400, 150); this.setAlwaysOnTop(true); this.getContentPane().setLayout(new CardLayout(0, 0)); this.getContentPane().add(this.initView()); this.setVisible(true); } private Component initView() {//create a panel with component panel = new JPanel(); panel.setLayout(null); icon = new ImageIcon(tetrisAttack.Application.class.getResource(path)); prog = new JProgressBar(); titleLbl = new JLabel(new ImageIcon(tetrisAttack.Application.class.getResource("text.gif"))); prog.setStringPainted(true); prog.setForeground(SystemColor.controlShadow); prog.setBounds(0, 486, this.getWidth(), 25);//set the progBar bounds(x,y,width,height) panel.add(prog); titleLbl.setBounds(6, 9, 506,87); image = new JLabel(icon); image.setLocation(0, 0);//set the location to background image image.setSize(506,491);//set the label dimension panel.add(titleLbl); panel.add(image); return panel; } /** * This method simulates the completion of the * loading JBar */ public void refresh(){ for(int i=0;i<=100;i++){ try { prog.setValue(i); Thread.sleep(50); } catch (Exception e) { } } dispose(); } }

Rispondi quotando