[Splash screen] fin d'appli
Bonjour,
J'essaye de faire un Splash screen pour la fin de mon appli.
Quand je rends ma JFrame non visible le splash screen disparait.
Je ne sais pas comment eviter cela et n'avoir que mon splash screen durant la fermeture de mon appli.
Voici un peu de code :
le constructeur du splsh screen
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
| public SplashWindow(String imagePath) {
super();
Dimension screenDimension = Toolkit.getDefaultToolkit().getScreenSize();
if (imagePath != null && !imagePath.equals("")) {
try{
animPanel = new AnimPanel ("Stop Processing ....");
int animPanelHeight = (int)(animPanel.getPreferredSize().getHeight());
int animPanelWidth = (int)(animPanel.getPreferredSize().getWidth());
int imgX = (screenDimension.width - animPanelWidth) / 2;
int imgY = (screenDimension.height - animPanelHeight) / 2;
add(animPanel);
setLocation(imgX,imgY);
animPanel.start();
}
catch(Throwable e){JOptionPane.showMessageDialog(this,e);}
} else {
setLocation(screenDimension.width / 2, screenDimension.height / 2);
}
pack();
setVisible(true);
} |
Dans la JDialog de ma MaJFrame
Code:
1 2 3 4 5 6 7 8 9 10
| ok.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
SplashWindow s = SplashWindow.getInstance("image/imageFin.jpg");
MaJFrame.this.setVisible(false);
fin();
}
}); |
Merci d'avnce.