Problème d'affichage de l'image screen splash
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
| /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
/**
*
* @author W.S.I
*/
import java.awt.Dimension;
import java.awt.Toolkit;
import javax.swing.ImageIcon;
import javax.swing.JDialog;
import javax.swing.JLabel;
import javax.swing.JPanel;
public class SplashJDialog extends JDialog implements Runnable{
private Fenetre fenetre;
/**
* Create the dialog.
*/
public SplashJDialog(Fenetre fenetre) {
setUndecorated(true);
this.fenetre = fenetre;
setBounds(100, 100, 500, 352);
getContentPane().setLayout(null);
JPanel panel = new JPanel();
panel.setBounds(0, 0, 543, 352);
getContentPane().add(panel);
panel.setLayout(null);
JLabel lblNewLabel = new JLabel("");
lblNewLabel.setBounds(0, 0, 510, 361);
//alcatel-Lucent-isologo2.jpg
lblNewLabel.setIcon(new ImageIcon("splash.jpg"));
panel.add(lblNewLabel);
Dimension screenSize =
Toolkit.getDefaultToolkit().getScreenSize();
setLocation(screenSize.width/2 - (452/2),
screenSize.height/2 - (401/2));
}
@Override
public void run() {
this.setVisible(true);
try {
Thread.sleep(3000);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
fenetre.setVisible(true);
this.dispose();
}
} |
c'est une classe pour le screen splash ;puis j'instancie cette classe dans main de la classe fenetre; le screen est blanc sans photo;je ne sais pas pourquoi?
Merci de vous m'aidez