-
Notifications
You must be signed in to change notification settings - Fork 0
/
RPSKLRunnerWithGUI.java
51 lines (38 loc) · 1.36 KB
/
RPSKLRunnerWithGUI.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
/**
* This is a Runner class with a main method that creates GUI for RPSKL.
*
** This code was inspired by Assignment 4.
*
* @author ChangSu Nam
* @UNI cn2521
* @since Assignment6 2.1
*/
public class RPSKLRunnerWithGUI {
public static void main(String[] args) {
JFrame frameForRPSKL = new JFrame();
final MovesGenerator movesRecord = new MovesGenerator();
final BattleField battleFieldForRPSKL = new BattleField(500, 500, 1, "rock");
movesRecord.addMove(battleFieldForRPSKL);
final IconOfRPSKL iconForRPSKL = new IconOfRPSKL(movesRecord, ICON_W, ICON_H);
final JLabel labelForRPSKL = new JLabel(iconForRPSKL);
MouseMotionManager RPSKLMouseMotionListner = new MouseMotionManager(labelForRPSKL);
frameForRPSKL.add(labelForRPSKL);
frameForRPSKL.setLayout(new FlowLayout());
frameForRPSKL.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frameForRPSKL.pack();
frameForRPSKL.setVisible(true);
RPSKLCreatorButtonSet moveGenerator = new RPSKLCreatorButtonSet(labelForRPSKL);
moveGenerator.pack();
moveGenerator.setVisible(true);
}
/**
* ICON_W the width of icon, ICON_H the height of icon, playerMove the move
* player will do, either R P S K or L
*/
private static final int ICON_W = 1000;
private static final int ICON_H = 1000;
private static String playerMove;
}