Réponse acceptée !
Bonjour,il faut utiliser la classe javax.swing.Timer dans une classe
qui implement ActionListener; ceci est une classe qui affiche une image
pendant 5 secondes (si je me souvients bien) . J'ai enlevé tout ce qui
n'est pas important.
code:
/**
* Class de lancement de genepopdatagenerator
* @author ANDRE Alain
*/
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class GDG extends JWindow implements ActionListener {
private int cpt = 0;
private javax.swing.Timer timer;
/** Creates a new instance of Genepop */
public GDG() {
// lancement du timer
timer = new javax.swing.Timer(599, this);
timer.start();
// disposition ...
int w = (int) Toolkit.getDefaultToolkit().getScreenSize().width;
int h = (int) Toolkit.getDefaultToolkit().getScreenSize().height;
validate();
setSize(400, 200);
setLocation(w/2-200, h/2-100);
setVisible(true);
}
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
GDG p = new GDG();
}
public void actionPerformed(ActionEvent e) {
cpt++;
if(cpt >= 5){
timer.stop();
Main m = new Main();
dispose();
}
}
}
---- OS: Ubuntu 5.10(linux) jdk : 1.5.0 MysqlConnector/J: 3.2 mysql Ver 12.22 Distrib 4.0.24, for pc-linux-gnu (i486) ----
|