Visualizzazione dei risultati da 1 a 8 su 8

Visualizzazione discussione

  1. #5
    Utente di HTML.it
    Registrato dal
    Feb 2014
    Messaggi
    40
    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();
        }    
        
    }
    Ultima modifica di LeleFT; 21-03-2014 a 12:57 Motivo: Aggiunti i tag CODE

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.