|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.eriksilkensen.sudoku.SudokuView
public class SudokuView
SudokuView is the View component in the M-V-C framework and so behaves like one would expect of a View.
It creates the entire GUI, and registers itself to listen in on events happening in the Model. It uses a Control in order to communicate with the Model, and allows for the Control to modify its state with lots of set() - type methods.
| Constructor Summary | |
|---|---|
SudokuView(SudokuControl controller)
The only constructor for a SudokuView. |
|
| Method Summary | |
|---|---|
void |
createView()
Creates the entire GUI |
void |
gameWon()
Required by the SudokuObserver interface. |
protected javax.swing.JFrame |
getFrame()
Returns the JFrame same-package and derived classes |
java.lang.String |
getHintLimit()
Hosts in a networked game have the ability to set a limit on the number of Hints that can be used in the game. |
int |
getID()
getId() prompts the user for the desired ID number of the Board they wish to play. |
void |
initRadioSelector()
Initializes the radio controls by enabling them and selecting the number 1 |
boolean |
isTimerEnabled()
Returns whether or not the Timer is enabled |
java.lang.String |
requestName()
Required by the SudokuObserver interface. |
void |
resetGameLabels()
Resets the top two labels to their default settings |
void |
setAllEnabled(boolean enabled)
Sets all important controls to be enabled or disabled |
void |
setAllNetworkEnabled(boolean enabled)
Sets all network controls to be enabled or disabled |
void |
setAllNonNetworkEnabled(boolean enabled)
Sets all controls that aren't using during a multiplayer game to be enabled or disabled |
void |
setBestTimesEnabled(boolean enabled)
Sets the best time controls to be enabled or disabled |
void |
setButtonText(int row,
int col,
int playerValue)
setButtonText() is crucial in updating the individual button cells with whatever value the user has decided to place at the specified location. |
void |
setChatEnabled(boolean enabled)
Sets the network chatting control to be enabled or disabled |
void |
setCheckEnabled(boolean enabled)
Sets the check controls to be enabled or disabled |
void |
setClearEnabled(boolean enabled)
Sets the clear controls to be enabled or disabled |
void |
setConnectEnabled(boolean enabled)
Sets the network connection control to be enabled or disabled |
void |
setDisconnectEnabled(boolean enabled)
Sets the network disconnection control to be enabled or disabled |
void |
setGiveUpEnabled(boolean enabled)
Sets the give up controls to be enabled or disabled |
void |
setHintButton(Hint hint)
Will place the passed hint on the Board. |
void |
setHintsEnabled(boolean enabled)
Sets the hint controls to be enabled or disabled |
void |
setNetworkConfigEnabled(boolean enabled)
Sets the network configuration contorl to be enabled or disabled |
void |
setPauseEnabled(boolean enabled)
Sets the pause controls to be enabled or disabled |
void |
setPrintEnabled(boolean enabled)
Sets the printing controls to be enabled or disabled |
void |
setRadiosEnabled(boolean enabled)
Sets the radio controls to be enabled or disabled |
void |
setSaveEnabled(boolean enabled)
Sets the save controls to be enabled or disabled |
void |
setStartEnabled(boolean enabled)
Sets the network starting control to be enabled or disabled |
void |
setTime(int time)
|
void |
setTimerEnabled(boolean enabled)
Sets whether or not the Timer should be used when playing games |
void |
setTimerLabelText(java.lang.String text)
Sets the timer label's text |
void |
show()
Simply shows the View by first centering the frame and then setting it to be visible. |
void |
showHomeScreen()
Handy method for bringing the user back to the 'Home Screen' after ending a game |
void |
startTimer()
Starts the Timer |
void |
stopTimer()
Stops the Timer |
void |
update(Observable obs,
java.lang.Object arg)
update() is what gets called when an Observable wants to update its Observers. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public SudokuView(SudokuControl controller)
The only constructor for a SudokuView. It requires a Control immediately in order to communicate with the Model.
The constructor registers the Observer with the Observable Model (through the Control), creates the Timer, and initializes the playerValue. The Control decides when to actually create the View.
| Method Detail |
|---|
public void createView()
public void show()
public void startTimer()
public void stopTimer()
public void setTimerEnabled(boolean enabled)
public boolean isTimerEnabled()
public void showHomeScreen()
public void setTimerLabelText(java.lang.String text)
public void setPauseEnabled(boolean enabled)
public void setClearEnabled(boolean enabled)
public void setRadiosEnabled(boolean enabled)
public void setBestTimesEnabled(boolean enabled)
public void setHintsEnabled(boolean enabled)
public void setCheckEnabled(boolean enabled)
public void setGiveUpEnabled(boolean enabled)
public void setSaveEnabled(boolean enabled)
public void setPrintEnabled(boolean enabled)
public void setConnectEnabled(boolean enabled)
public void setDisconnectEnabled(boolean enabled)
public void setStartEnabled(boolean enabled)
public void setChatEnabled(boolean enabled)
public void setNetworkConfigEnabled(boolean enabled)
public void setAllNonNetworkEnabled(boolean enabled)
public void setAllNetworkEnabled(boolean enabled)
public void setAllEnabled(boolean enabled)
public void initRadioSelector()
public void update(Observable obs,
java.lang.Object arg)
update in interface Observerpublic void resetGameLabels()
public void setHintButton(Hint hint)
public void gameWon()
gameWon in interface SudokuObserverprotected javax.swing.JFrame getFrame()
public java.lang.String requestName()
requestName in interface SudokuObserverpublic int getID()
public void setTime(int time)
public java.lang.String getHintLimit()
public void setButtonText(int row,
int col,
int playerValue)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||