データベースを操作するための読み込みウィンドウを作成しました。が要請されたときにウィンドウが表示されないため、問題が発生しました。私のコードを見て、助けてもらえますか?
private void btCadastrarUsuarioActionPerformed(java.awt.event.ActionEvent evt) {
LoadingWindow lw = new LoadingWindow(this);
lw.show(null,jpanel1);
if(confereSobrenome==true && confereEmail==true && confereSenha==true &&
confereNome==true && confereUser==true && confereSenhaConfirmacao==true){
FileInputStream fis;
if (fileFoto==null){
String path = this.getClass().getResource("/img/no_pic.jpg").getFile();
fileFoto=new File(path);
}
ImageIcon icone;
try {
Image image = ImageIO.read(fileFoto);
icone = new ImageIcon(image);
} catch (IOException ex) {
icone = new ImageIcon(getClass().getResource("/img/no_pic.jpg"));
}
icone.setDescription(fileFoto.getAbsolutePath());
UsuarioDao dao = new UsuarioDao();
if(btCadastrarUsuario.getText().equals("Atualizar")){
user.setFoto(icone);
dao.alteraUsuario(user);
}else{
Usuario user = new Usuario(txtUser.getText(), icone, txtPrimeiroNome.getText(), txtUltimoNome.getText(), new String (txtSenha.getPassword()), txtEmail.getText(),0,0);
dao.adicionaUsuario(user);
}
if(btCadastrarUsuario.getText().equals("Atualizar")){
btCadastrarUsuario.setText("Cadastrar");
CardLayout cards = (CardLayout)(jpPrincipal.getLayout());
cards.show(jpPrincipal, "apostas");
jLabel4.setIcon(new Util().dimencionaImagem(user.getFoto(),80));
}else{
this.dispose();
BolaoFuleco.main(null);
newUser=false;
CardLayout cards = (CardLayout)(jpPrincipal.getLayout());
cards.show(jpPrincipal, "cadastro");
}
}
try {
Thread.sleep(1300);
} catch (InterruptedException ex) {
Logger.getLogger(bolaoJFrame.class.getName()).log(Level.SEVERE, null, ex);
}
lw.close();
}
ここに LoadingWindow クラスがあります。
public class LoadingWindow extends JWindow{
public LoadingWindow(Frame owner) {
super(owner);
inicialize();
}
public void inicialize(){
setLayout(null);
//Util.centralizarJanela(this, 150, 150);
getContentPane().setBackground(Color.BLACK);
getContentPane().setLayout(new GridLayout(1,1));
JLabel imgLoading = new JLabel(new javax.swing.ImageIcon(getClass().getResource("/img/ipad_loading_40x40.gif")));
getContentPane().add(imgLoading);
//70% de transparência
AWTUtilities.setWindowOpacity(this, .8f);
setSize(50,50);
}
public void show(String texto, java.awt.Component componentOwner){
setLocationRelativeTo(componentOwner);
if(texto!=null){
getContentPane().setLayout(new GridLayout(2,1));
JLabel lbTexto = new JLabel(texto);
lbTexto.setForeground(Color.WHITE);
lbTexto.setFont(new java.awt.Font("Arial", 1, 12));
lbTexto.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
getContentPane().add(lbTexto);
}
setVisible(true);
}
public void close(){
setVisible(false);
dispose();
}
public void noShow(){
setVisible(false);
}
}