Browse Source

Update Methode void BuildGui and add class NewGameListener

main
Thoumi Ngonga Brice 2 years ago
parent
commit
84d2395eaa
  1. 15
      src/main/java/BattleShip/BShip.java

15
src/main/java/BattleShip/BShip.java

@ -1,6 +1,8 @@
package BattleShip; package BattleShip;
import javax.swing.*; import javax.swing.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class BShip { public class BShip {
@ -35,6 +37,19 @@ public class BShip {
boardSize[1] = new JMenuItem("10x10"); boardSize[1] = new JMenuItem("10x10");
boardSize[2] = new JMenuItem("12x12"); boardSize[2] = new JMenuItem("12x12");
JMenuBar bar = new JMenuBar();
JMenu menu = new JMenu("file");
JMenuItem newGame = new JMenuItem("New Game");
newGame.addActionListener(new NewGameListener());
JMenu sizes = new JMenu("Board Size");
for(int i = 0; i < boardSize.length; i++) {
boardSize[i].addActionListener(new NewGameListener());
sizes.add(boardSize[i]);
}
}
public class NewGameListener implements ActionListener {
public void actionPerformed(ActionEvent a) {}
} }
} }
Loading…
Cancel
Save