Created
May 26, 2016 14:46
-
-
Save anymaniax/1eec84af6eced92cc32ef9c46e8940ef to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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