You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
package solitaer;
import java.awt.event.ActionEvent; import java.awt.event.ActionListener;
import javax.swing.JMenu; import javax.swing.JMenuBar; import javax.swing.JMenuItem;
public class SolitaerMenue implements ActionListener{ SolitaerGamePanel solitaerpanel; JMenuBar menuBar = new JMenuBar(); JMenu menu = new JMenu("options"); JMenuItem restart = new JMenuItem("restart"); JMenuItem quit = new JMenuItem("quit"); public SolitaerMenue(SolitaerGamePanel _panel) { solitaerpanel = _panel; this.restart.addActionListener(this); this.menu.add(restart); this.menu.addSeparator(); this.quit.addActionListener(this); this.menu.add(quit); this.menuBar.add(menu); } public JMenuBar getMenue() { 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); } if(e.getSource() == this.restart) { solitaerpanel.restartGame(); } }
}
|