|
@ -1,8 +1,12 @@ |
|
|
package BattleShip; |
|
|
package BattleShip; |
|
|
|
|
|
|
|
|
|
|
|
import javax.swing.*; |
|
|
|
|
|
|
|
|
public class BShip { |
|
|
public class BShip { |
|
|
|
|
|
|
|
|
public GridGUI grid1; |
|
|
public GridGUI grid1; |
|
|
|
|
|
JPanel thePanel = new JPanel(); |
|
|
|
|
|
JMenuItem[] boardSize = new JMenuItem[3]; |
|
|
public AIGridGUI grid2; |
|
|
public AIGridGUI grid2; |
|
|
int rows = 10; |
|
|
int rows = 10; |
|
|
int columns = 10; |
|
|
int columns = 10; |
|
@ -19,6 +23,18 @@ public class BShip { |
|
|
buildGUI(); |
|
|
buildGUI(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public void buildGUI() {} |
|
|
|
|
|
|
|
|
public void buildGUI() { |
|
|
|
|
|
|
|
|
|
|
|
thePanel.setLayout(new BoxLayout(thePanel, BoxLayout.PAGE_AXIS)); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
thePanel.add(grid1); |
|
|
|
|
|
|
|
|
|
|
|
//Setup menu with options for new game, varying board sizes, and auto placement of ships. |
|
|
|
|
|
boardSize[0] = new JMenuItem("8x8"); |
|
|
|
|
|
boardSize[1] = new JMenuItem("10x10"); |
|
|
|
|
|
boardSize[2] = new JMenuItem("12x12"); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |