Pessoal, não to conseguindo fechar a tela splash , após entra na tela de cadastro, ela fica no fundo ainda rodando.
caso alguem tem uma suposição de como fazer agradeço.
valeu
package controller;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Toolkit;
import javax.swing.ImageIcon;
import javax.swing.JLabel;
import javax.swing.JProgressBar;
import view.Principal.Janela_Registrar;
public class SplashJProgressBar extends javax.swing.JWindow {
/**
*
*/
private static final long serialVersionUID = 1L;
private JLabel jLabelSplashImage;
private JLabel jLabelTextoCarregamento;
private static JLabel jLabelTextoDinamicoPlugins;
private static JProgressBar jProgressBarSistema;
private void criandoComponentes() {
/**
* Inicializando as variavaeis utilizadas
*/
jProgressBarSistema = new JProgressBar();
jLabelSplashImage = new JLabel();
jLabelTextoCarregamento = new JLabel();
jLabelTextoDinamicoPlugins = new JLabel();
/**
* Carregando a imagem do Splash e adicionando a imagem ao componente
* jLabelSplashImage
*/
ImageIcon imageIcon = new ImageIcon(getClass().getResource("/images/members-login-right.jpg"));
jLabelSplashImage.setIcon(imageIcon);
/**
* Definindo dinamicamente o tamando do container segundo o tamanho da imagem.
*/
this.setMinimumSize(new java.awt.Dimension(imageIcon.getIconWidth(),imageIcon.getIconHeight()));
jLabelSplashImage.setBounds(0, 0, imageIcon.getIconWidth(), imageIcon.getIconHeight());
/**
* A definicao do layout=null e importante para possibilitar que os componentes
* fiquem sobrescritros em tempo de execucao
*/
getContentPane().setLayout(null);
/**
* Definindo a localizacao do splash no centro da tela
*/
Dimension screen = Toolkit.getDefaultToolkit().getScreenSize();
this.setLocation((screen.width - this.getSize().width) / 2, (screen.height - this.getSize().height) / 2);
/**
* Setando parametros da variavel jProgressBarSistema
*/
jProgressBarSistema.setForeground(new Color(0,0,204));
jProgressBarSistema.setPreferredSize(new java.awt.Dimension(148, 5));
jProgressBarSistema.setBounds(0, 266, imageIcon.getIconWidth(), 5);
jProgressBarSistema.setBorderPainted(false);
jProgressBarSistema.setIndeterminate(true);
/**
* Adicionando o jProgressBarSistema a classe SplashJProgressBar
*/
getContentPane().add(jProgressBarSistema);
/**
* Setando parametros da variavel jProgressBarSistema
*/
jLabelTextoCarregamento.setForeground(new java.awt.Color(0,0,204));
jLabelTextoCarregamento.setFont(new java.awt.Font("DialogInput", 0, 11));
jLabelTextoCarregamento.setText("Loading .......");
jLabelTextoCarregamento.setBounds(10, 285, 80, 20);
/**
* Adicionando o jProgressBarSistema a classe SplashJProgressBar
*/
this.getContentPane().add(jLabelTextoCarregamento);
/**
* Setando parametros da variavel jProgressBarSistema
*/
jLabelTextoDinamicoPlugins.setForeground(new java.awt.Color(0,0,204));
jLabelTextoDinamicoPlugins.setFont(new java.awt.Font("DialogInput", 0, 11));
jLabelTextoDinamicoPlugins.setBounds(200, 285, 230, 20);
/**
* Adicionando o jProgressBarSistema a classe SplashJProgressBar
*/
this.getContentPane().add(jLabelTextoDinamicoPlugins);
/**
* O Ultimo item adicionado no conteiner deve ser o componente que comtem
* a imagem do Splah
*/
this.getContentPane().add(jLabelSplashImage);
this.pack();
}
public SplashJProgressBar() {
criandoComponentes();
this.setVisible(true);
}
public static void main(String args[]) {
new SplashJProgressBar();
/**
* Rotina para exibicao de um texto qualquer no carregamento do seu
* sistema
*/
for(int i=0; i<= 100; i++){
try {
Thread.sleep(100);
} catch (InterruptedException ex) {
System.out.println("Erro na thread");
}
jLabelTextoDinamicoPlugins.setText("Exibição da tela de Cadastro:" + i);
}
new Janela_Registrar().setVisible(true);
}
}