Browse Source

Add MouseInput MenueQuit-Button

feature_solitaer_MenueBar
Alexander Hartung 3 years ago
parent
commit
e902f029ce
  1. 18
      src/main/java/solitaer/SolitaerMenue.java

18
src/main/java/solitaer/SolitaerMenue.java

@ -1,10 +1,13 @@
package solitaer; package solitaer;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JMenu; import javax.swing.JMenu;
import javax.swing.JMenuBar; import javax.swing.JMenuBar;
import javax.swing.JMenuItem; import javax.swing.JMenuItem;
public class SolitaerMenue {
public class SolitaerMenue implements ActionListener{
JMenuBar menuBar = new JMenuBar(); JMenuBar menuBar = new JMenuBar();
@ -15,10 +18,13 @@ public class SolitaerMenue {
public SolitaerMenue() { public SolitaerMenue() {
this.restart.addActionListener(this);
this.menu.add(restart); this.menu.add(restart);
this.menu.addSeparator(); this.menu.addSeparator();
this.quit.addActionListener(this);
this.menu.add(quit); this.menu.add(quit);
this.menuBar.add(menu); this.menuBar.add(menu);
} }
@ -27,4 +33,14 @@ public class SolitaerMenue {
return menuBar; return menuBar;
} }
@Override
public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub
if(e.getSource() == this.quit) {
System.out.println("quit");
System.exit(0);
}
}
} }
Loading…
Cancel
Save