java.lang.ObjectSameView
public class SameView
This class works on the game's view. It paints the view, changes it, displays it.
Nested Class Summary | |
---|---|
class |
SameView.Box
An inner class that represents the Box. |
Constructor Summary | |
---|---|
SameView(SameModel model)
The constructor takes the model as the only parameter |
Method Summary | |
---|---|
void |
changeSameHover()
Called when a mouse cursor hovers over a Box, will highlight the said Box (and nearby matching boxes), and update the score Called when the mouse enters a Box |
void |
changeSameHovered()
When the mouse has exited the hovered boxes, the highlight Boolean is set to false for all boxes Called when the mouse exits a Box |
void |
changeSameNew()
Calls the newGame method, and then closes the Dialog box Called when the New Game button is pressed or OK is pressed on the Dialog box |
void |
exitFrame()
Disposes existing frames, called during JUnit tests as each test creates a new frame window |
void |
gameOver()
Will show the game over Dialog box, after setting the score in the label |
javax.swing.JButton |
gameOverButton()
Returns the Game Over button |
SameView.Box |
getBox(int panelNum)
Returns the Box specified in the parameter |
int |
getBoxNum(java.awt.event.MouseEvent event)
The MouseEvent Parameter, is used to work out the index position of the Box the MouseEvent occured upon Here again, the controller and view are kept seperate, where each of them only carry out the parts of the code that are specific to them |
int |
getDimention()
Returns the current value in the dimention JSpinner |
int |
getNumColours()
Returns the current value in the numColours JSpinner |
javax.swing.JButton |
hintButton()
Returns the Hint button |
void |
newGame()
Sets some variables that have to be reset, when a new game is started |
javax.swing.JButton |
newGameButton()
Returns the New Game button |
void |
reColourBoxes()
Loops through the Box'es and sets the colour for the Box |
void |
repaintFrame()
Repaints the frame |
void |
updateScores()
Upadtes the score and hoverScore with the latest values from the the model |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public SameView(SameModel model)
SameModel,
- the model the game view will retrieve data fromMethod Detail |
---|
public void changeSameHover()
public void changeSameHovered()
public void changeSameNew()
public void exitFrame()
public void gameOver()
public javax.swing.JButton gameOverButton()
public SameView.Box getBox(int panelNum)
int
- index position of Box
public int getBoxNum(java.awt.event.MouseEvent event)
MouseEvent
-
public int getDimention()
public int getNumColours()
public javax.swing.JButton hintButton()
public void newGame()
public javax.swing.JButton newGameButton()
public void reColourBoxes()
public void repaintFrame()
public void updateScores()