Ola fiz um splash para o um sistema, mais nao to conseguindo para quando rodar o sistema aparecer o splash e depois o sistema so consigo quando boto o splash como programa principal so aparece o splash nao o sistema alguem poderia tirar esse minha duvida.Obrigado.
Duvida SplashScreen
W
3 Respostas
L
Tenta rodar o splash numa thread…então o splash vai rodar em paralelo… no final da construção da sua tela inicial, vc finaliza a thread sumindo então o splash
W
Eu fiz isso mais o splash sai mais o programa ainda fica rodando nao chamando o Form nao sei o que ta havendo.Obrigado
C
Se colocar o código fica melhor, mas vc pode fazer assim:
public class SplashWindow extends JWindow{
AbsoluteLayout absoluto;
AbsoluteConstraints absimage, absbarra;
ImageIcon image;
JLabel jlabel;
JProgressBar barra;
public SplashWindow(){
absoluto = new AbsoluteLayout();
absimage = new AbsoluteConstraints(0,0);
absbarra = new AbsoluteConstraints(0, 228);
jlabel = new JLabel();
image = new ImageIcon(this.getClass().getResource("splash.jpg"));
barra = new JProgressBar();
barra.setPreferredSize(new Dimension(386,15));
jlabel.setIcon(image);
this.getContentPane().setLayout(absoluto);
this.getContentPane().add(jlabel, absimage);
this.getContentPane().add(barra, absbarra);
this.pack();
this.setVisible(true);
this.setLocationRelativeTo(null);
new Thread(){
public void run(){
int i=0;
while (i<101){
barra.setValue(i);
i++;
try {
sleep(30);
} catch (InterruptedException ex) {
Logger.getLogger(SplashWindow.class.getName()).log(Level.SEVERE, null, ex);
}
}
dispose();
new GUIPrincipal();
}
}.start();
}
}
Criado 24 de março de 2011
Ultima resposta 24 de mar. de 2011
Respostas 3
Participantes 3