|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.cometway.props.Props
com.cometway.ak.Agent
com.cometway.swing.AbstractJFrameAgent
com.cometway.swing.AbstractJFrameController
com.cometway.swing.LightBox
public class LightBox
This agent displays a frame that contains Lights, or more accurately colored squares, that are drawn in a grid style array. The LightBox agent registers itself with the Service Manager so that it may be found and used by other agents to display state information.
| Field Summary | |
|---|---|
static int |
BLACK
|
static int |
BLUE
|
static int |
BLUE0
|
static int |
BLUE1
|
static int |
BLUE2
|
static int |
BLUE3
|
static int |
BLUE4
|
static int |
DIM_BLUE
|
static int |
DIM_GREEN
|
static int |
DIM_RED
|
static int |
GREEN
|
static int |
GREEN0
|
static int |
GREEN1
|
static int |
GREEN2
|
static int |
GREEN3
|
static int |
GREEN4
|
static int |
RED
|
static int |
RED0
|
static int |
RED1
|
static int |
RED2
|
static int |
RED3
|
static int |
RED4
|
static int |
WHITE
|
static int |
YELLOW
|
| Fields inherited from class com.cometway.swing.AbstractJFrameAgent |
|---|
frame, menu, menuActionListener, menuBar, windowListener |
| Fields inherited from class com.cometway.ak.Agent |
|---|
agent_id, agentController, CREATING_STATE, debugReporter, DESTROYED_STATE, DESTROYING_STATE, errorReporter, FAILED_STATE, printlnReporter, props, RUNNING_STATE, STARTING_STATE, STOPPED_STATE, STOPPING_STATE, warningReporter |
| Constructor Summary | |
|---|---|
LightBox()
|
|
| Method Summary | |
|---|---|
protected void |
drawCell(java.awt.Graphics g,
int h,
int v)
This method draws a single cell based on its stored state. |
protected void |
drawCells(java.awt.Graphics g,
boolean changedOnly)
This method draws all of the cells. |
void |
drawChangedCells()
Called by clients to immediately draw all changed cells. |
void |
drawFrame(java.awt.Graphics g)
This method is called to draw the entire frame contents. |
int |
getCellIndex(int h,
int v)
Returns the index of the specified cell. |
int |
getCellState(int index)
Returns the current state of the specified cell. |
int |
getCellState(int h,
int v)
Returns the current state of the specified cell. |
int |
getRandomEmptyCell()
Returns the index of a random empty cell. |
void |
initProps()
Initializes the Props for this agent. |
protected void |
openFrame()
Creates and initializes the JFrame used to display the Light Box. |
void |
setCellState(int index,
int newState)
Called by clients to set the state of a specific cell designated by its index in the array of cells. |
void |
setCellState(int h,
int v,
int newState)
Called by clients to set the state of a specific cell designated by horizontal and vertical coordinates. |
void |
start()
Opens the LightBox frame and registers this agent with the Service Manager. |
| Methods inherited from class com.cometway.swing.AbstractJFrameController |
|---|
createFrame, getFrame, stop |
| Methods inherited from class com.cometway.swing.AbstractJFrameAgent |
|---|
closeFrame, createMenu, createMenuActionListener, createWindowListener, setLookAndFeel, setMenuBar |
| Methods inherited from class com.cometway.ak.Agent |
|---|
currentStateEquals, debug, destroy, error, error, getAgentController, getDateTimeStr, getProps, getServiceImpl, getStateMachineModel, println, register, registerService, setAgentController, setProps, toString, unregister, unregisterService, warning, warning |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final int BLACK
public static final int WHITE
public static final int RED
public static final int GREEN
public static final int BLUE
public static final int YELLOW
public static final int DIM_RED
public static final int DIM_GREEN
public static final int DIM_BLUE
public static final int RED0
public static final int RED1
public static final int RED2
public static final int RED3
public static final int RED4
public static final int GREEN0
public static final int GREEN1
public static final int GREEN2
public static final int GREEN3
public static final int GREEN4
public static final int BLUE0
public static final int BLUE1
public static final int BLUE2
public static final int BLUE3
public static final int BLUE4
| Constructor Detail |
|---|
public LightBox()
| Method Detail |
|---|
public void initProps()
initProps in interface AgentInterfaceinitProps in class AbstractJFrameControllerpublic void start()
start in interface AgentInterfacestart in class AbstractJFrameControllerpublic int getCellState(int index)
public int getCellState(int h,
int v)
public int getCellIndex(int h,
int v)
public int getRandomEmptyCell()
protected void openFrame()
openFrame in class AbstractJFrameAgentpublic void drawFrame(java.awt.Graphics g)
drawFrame in class AbstractJFrameController
protected void drawCell(java.awt.Graphics g,
int h,
int v)
protected void drawCells(java.awt.Graphics g,
boolean changedOnly)
public void drawChangedCells()
public void setCellState(int index,
int newState)
public void setCellState(int h,
int v,
int newState)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||