Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package projet2;
- import javax.swing.JButton;
- import javax.swing.JFrame;
- import javax.swing.JPanel;
- import java.awt.Color;
- import java.awt.GridLayout;
- public class Fenetre extends JFrame {
- // CardLayout cl = new CardLayout();
- public Fenetre(){
- // JButton bouton = new JButton("Ceci est un bouton");
- GridLayout gl = new GridLayout();
- gl.setColumns(1);
- gl.setRows(3);
- gl.setHgap(5);
- gl.setVgap(5);
- this.setLayout(gl);
- this.setTitle("Fenêtre");
- this.setSize(400, 500);
- this.setLocationRelativeTo(null);
- this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
- this.setVisible(true);
- JPanel card1 = new JPanel();
- card1.setBackground(Color.blue);
- JPanel card2 = new JPanel();
- card2.setBackground(Color.red);
- JPanel card3 = new JPanel();
- card3.setBackground(Color.green);
- JPanel pan = new JPanel();
- pan.setBackground(Color.ORANGE);
- this.setContentPane(pan);
- this.setVisible(true);
- this.getContentPane().add(new Bouton("1", Color.white, Color.black, Color.red));
- this.getContentPane().add(new Bouton("2", Color.cyan, Color.magenta, Color.yellow));
- this.getContentPane().add(new JButton("3"));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement