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
| import java.awt.FlowLayout;
import java.awt.Container;
import javax.swing.JFrame;
import javax.swing.JButton;
import java.awt.event.*;
public class SimpleFrame extends JFrame {
//constructeur de simpleFrame
public SimpleFrame () {
System.out.println("Constructeur de la fenetre 1 !");
this.setTitle("Vous etes sur la 1ere fenetre !");
this.setDefaultCloseOperation(EXIT_ON_CLOSE);
this.setSize(300,100);
Contenu MonContenu = new Contenu(this);
//afin que le contenu detaillé dans l'objet contenu, sopit positionné ds la fenetre ,
// on utilise l'objet container
Container LeContenant = getContentPane();
LeContenant.add(MonContenu);
this.setVisible(true);
}
} |