Skip to content

Commit

Permalink
Fixed conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
john committed Apr 13, 2016
2 parents 0315026 + 8fdfc6a commit e74ba68
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 0 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
# CSE-4705-Checkers
A very good checkers player.

So far the view works.
1 change: 1 addition & 0 deletions src/view/CheckersCanvas.java
Original file line number Diff line number Diff line change
Expand Up @@ -81,4 +81,5 @@ private void initCheckers() {
}
}
}

}
57 changes: 57 additions & 0 deletions src/view/CheckersWindow.java
Original file line number Diff line number Diff line change
@@ -1,27 +1,84 @@
package view;

import java.awt.BorderLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;

import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.JOptionPane;


public class CheckersWindow extends JFrame {

public static final int HEIGHT = 825;
public static final int WIDTH = 800;
private GamePanel gamePanel;


public CheckersWindow() {
super("Checkers");
this.setSize(WIDTH, HEIGHT);
this.setDefaultCloseOperation(EXIT_ON_CLOSE);
this.setResizable(false);
this.setLocationRelativeTo(null);
initGamePanel();
this.createMenuBar();
this.setVisible(true);
this.setResizable(false);

//pack();
}

private void createMenuBar() {
JMenuBar menubar = new JMenuBar();
JMenu file = new JMenu("File");
//New Game
JMenuItem newGame = new JMenuItem("New game");
newGame.setMnemonic(KeyEvent.VK_N);
newGame.setToolTipText("Start a new game");
newGame.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
//this.getContentPane().add(new CheckersCanvas(), BorderLayout.CENTER);
}
});
//Quit
JMenuItem quit = new JMenuItem("Quit");
quit.setMnemonic(KeyEvent.VK_Q);
quit.setToolTipText("Exit application");
quit.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
System.exit(0);
}
});
//Rules
JMenuItem instructions = new JMenuItem("Instructions");
instructions.setMnemonic(KeyEvent.VK_I);
instructions.setToolTipText("How to play");
instructions.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
JOptionPane.showMessageDialog(null, "<html><ol><li>instr 1</li></ol></html>", "title", JOptionPane.INFORMATION_MESSAGE);
//JOptionPane.showMessageDialog(null, "<html>instr 1<br></html>", "title", JOptionPane.INFORMATION_MESSAGE);
}
});

file.add(quit);
file.add(newGame);
file.add(instructions);
menubar.add(file);
menubar.setVisible(true);
setJMenuBar(menubar);
}


private void initGamePanel() {
this.gamePanel = new GamePanel();
this.getContentPane().add(this.gamePanel, BorderLayout.CENTER);
Expand Down

0 comments on commit e74ba68

Please sign in to comment.