Skip to content

Instantly share code, notes, and snippets.

@anymaniax
Created May 26, 2016 14:46
Show Gist options
  • Save anymaniax/1eec84af6eced92cc32ef9c46e8940ef to your computer and use it in GitHub Desktop.
Save anymaniax/1eec84af6eced92cc32ef9c46e8940ef to your computer and use it in GitHub Desktop.
public class FrmFenetre extends JFrame{
public FrmFenetre (){
JPanel pnlPanneau=new JPanel () ;
this.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE ) ;
this.setContentPane ( pnlPanneau ) ;
this.setSize (300 ,200) ;
this.setTitle("Exemple 2");
JButton btnBoutonR = new JButton("Rouge");
JButton btnBoutonV = new JButton("Vert");
JLabel lblcouleur = new JLabel();
CouleurAction couleurAction=new CouleurAction ( lblCouleur ) ;
btnBoutonR.addActionListener( couleurAction ) ;
btnBoutonV.addActionListener ( couleurAction ) ;
pnlPanneau.add( btnBoutonR ) ;
pnlPanneau.add( btnBoutonV ) ;
pnlPanneau.add ( lblCouleur ) ;
}
public static void main(String [] args) {
FrmFenetre maFenetre = new FrmFenetre () ;
maFenetre.setVisible( true ) ;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment