public class DominoButtonController
extends java.lang.Object
implements java.awt.event.ActionListener
DominoSpecification
providing 2 buttons in its own frame:
DominoMVC
Modifier and Type | Field and Description |
---|---|
(package private) javax.swing.JButton |
buttonRandomizeDomino
The button for randomizing the domino
|
(package private) javax.swing.JButton |
buttonSwitchDomino
The button for switching the domino
|
(package private) ObservableDomino |
domino
The domino to be randomized when the button is pressed
|
(package private) javax.swing.JFrame |
frame
The frame in which the domino button will be displayed
|
(package private) static int |
HEIGHT
The height of the frame should be big enough for two buttons arranged vertically
|
(package private) static java.lang.String |
RANDOMIZE
The label in the randomize button
|
(package private) static java.lang.String |
SWITCH
The label in the switch button
|
(package private) static int |
WIDTH
The width of the frame should be big enough for the button text horizontally
|
Constructor and Description |
---|
DominoButtonController(ObservableDomino d,
int i,
int j)
A 2-button controller for a domino:
Button for switching the domino around (swapping left and right values)
Button for randomly selecting a new domino
|
Modifier and Type | Method and Description |
---|---|
void |
actionPerformed(java.awt.event.ActionEvent actionEvent)
Actions performed when either button is pressed
RANDOMIZE - replace current domino with a new randomly generate domino
SWITCH - flip the values on the left and right sides of the current domino
|
static final int WIDTH
static final int HEIGHT
static final java.lang.String RANDOMIZE
static final java.lang.String SWITCH
javax.swing.JFrame frame
javax.swing.JButton buttonRandomizeDomino
javax.swing.JButton buttonSwitchDomino
ObservableDomino domino
public DominoButtonController(ObservableDomino d, int i, int j)
d
- is the domino model to which the button controller is connectedi
- horizontal screen positionj
- vertical screen positionpublic void actionPerformed(java.awt.event.ActionEvent actionEvent)
actionPerformed
in interface java.awt.event.ActionListener