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
|
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.Timer;
public class Fen extends JFrame {
/**
* author slim_java
*/
int i =0;
JDialog boîte = new JDialog();
public static void main(String args[]) {
try {
Fen frame = new Fen();
frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
public Fen() {
super();
setBounds(100, 100, 500, 375);
boîte.setBounds(this.getX()+50, this.getY()+50, 300, 200);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
ActionListener taskPerformer = new ActionListener() {
public void actionPerformed(ActionEvent evt)
{
i++;
boîte.setVisible(true);
boîte.setTitle("boite de dialogue num : -- "+i+" --");
boîte.setVisible(false);
}
};
Timer temp = new Timer(2000, taskPerformer);
temp.start();
}
} |
Partager