Advertisement
Guest User

Untitled

a guest
Feb 21st, 2020
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.08 KB | None | 0 0
  1. package mvc;
  2.  
  3. import java.awt.BorderLayout;
  4. import java.awt.HeadlessException;
  5. import java.awt.event.ActionEvent;
  6. import java.awt.event.ActionListener;
  7.  
  8. import javax.swing.JButton;
  9. import javax.swing.JFrame;
  10. import javax.swing.JPanel;
  11.  
  12. public class FeuGUI extends JFrame {
  13.  
  14.  
  15. private static final long serialVersionUID = 586870147455311879L;
  16. protected FeuTricolore feu;
  17.  
  18.  
  19.  
  20. /**
  21. * Constructeur de FeuGUI
  22. * @param ft
  23. * @throws HeadlessException
  24. */
  25.  
  26. public FeuGUI() {
  27. this(new FeuTricolore());
  28. }
  29.  
  30. public FeuGUI(FeuTricolore feu) throws HeadlessException {
  31. super("Feux Tricolores de signalisation");
  32. JButton next = new JButton("Next");
  33. VueFeu vue = new VueFeu(feu);
  34.  
  35. this.feu = feu;
  36. this.add(next, BorderLayout.SOUTH);
  37. next.addActionListener(new ActionListener() {
  38.  
  39. @Override
  40. public void actionPerformed(ActionEvent arg0) {
  41. feu.changeColor();
  42. }
  43. });
  44.  
  45.  
  46. this.pack();
  47. this.setLocationRelativeTo(null);
  48. this.setVisible(true);
  49. this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
  50. }
  51.  
  52.  
  53.  
  54.  
  55. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement