Ombitious_Developper
Messages postés2333Date d'inscriptionsamedi 28 février 2004StatutMembreDernière intervention26 juillet 201338 16 oct. 2008 à 09:00
Salut:
Pour visualiser une application Swing, il faut utiliser un composant lourd:
1. JFrame
2. JDialog
3. JApplet
4. JWindow
public class MyPanel extends JPanel {
public MyPanel() {
setPreferredSize(new Dimension(300, 300));
}
public class MyFrame extends JFrame {
public MyFrame() {
super("Dessin");
setDefaultCloseOperation(EXIT_ON_CLOSE);
getContentPane().add(new MyPanel());
pack();
}
public static void main(String[] args) {
MyFrame frame = new MyFrame();
frame.setVisible(true);
}
}