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
|
public class test_ extends Panel implements ActionListener, Runnable{
..............
......
public static void main(String[] args) throws IOException {
Frame f=new Frame("Frame 1");
test cf = new test();
f.add(cf);
f.pack();
f.setSize(320, 550);
f.setVisible(true);
Thread t = new Thread("Thread c ");
t.start();
System.out.println("Lancement du Thread ...");
System.out.println("Exécution en cours....");
t.run();
}
@Override
public void run() {
int i =0;
System.out.pritln("nombre " + i + "..." );
Thread.sleep(20);
}
} |
Partager