Boa tarde pessoas!
To tendo um problema com splash… O Netbeans carrega um “quadrado branco” mas a imagem que armazenei não carrega. E ele não está carregando o Entrar.java depois. Ou seja, O quadrado branco some depois de um tempo, mas o Entrar.java não é exibido.
https://lh3.googleusercontent.com/-7IRsLB7QgnM/UMnzkSv0dAI/AAAAAAAAAWQ/lQmJl7IGuKw/s800/quadrado.jpg
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package sfashion;
import fronteira.Entrar;
import java.awt.*;
import javax.swing.*;
public class SplashScreen extends JWindow {
private int duration;
public SplashScreen(int d) {
duration = d;
}
// Este é um método simples para mostrar uma tela de apresentção
// no centro da tela durante a quantidade de tempo passada no construtor
public void showSplash() {
JPanel content = (JPanel)getContentPane();
content.setBackground(Color.white);
// Configura a posição e o tamanho da janela
int width = 808;
int height =485;
Dimension screen = Toolkit.getDefaultToolkit().getScreenSize();
int x = (screen.width-width)/2;
int y = (screen.height-height)/2;
setBounds(x,y,width,height);
// Constrói o splash screen
JLabel label = new JLabel(new ImageIcon("sfashion/src/imagens/splash.png"));
Color oraRed = new Color(156, 20, 20, 255);
content.setBorder(BorderFactory.createLineBorder(oraRed, 10));
// Torna visível
setVisible(true);
// Espera ate que os recursos estejam carregados
try { Thread.sleep(duration); } catch (Exception e) {}
setVisible(false);
}
public void showSplashAndExit() {
showSplash();
System.exit(0);
}
public static void main(String[] args) {
// Mostra uma imagem com o título da aplicação
SplashScreen splash = new SplashScreen(10000);
splash.showSplashAndExit();
Entrar e = new Entrar();
e.setVisible(true);
