public class CellGrid
extends javax.swing.JComponent
implements java.awt.event.MouseMotionListener, java.io.Serializable
javax.swing.JComponent.AccessibleJComponent
Modifier and Type | Field and Description |
---|---|
static int |
BALL |
static int |
COUNTS |
static int |
NONE |
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
Constructor and Description |
---|
CellGrid()
This default constructor creates a new cell grid with 20 cells.
|
CellGrid(int m)
This general constructor: creates a new cell grid with a specified number of cells.
|
Modifier and Type | Method and Description |
---|---|
java.awt.Color |
getBallColor()
This method returns the ball color
|
int |
getBigColumns()
This method returns the number of big columns in the cell grid.
|
int[] |
getCellCount()
This method returns the counts for all of the cells.
|
int |
getCellCount(int i)
This method returns the cell count for an individual cell.
|
int |
getCells()
This method returns the number of cells.
|
int |
getColumns()
This method returns the number of columns in the cell grid.
|
java.awt.Color |
getCountColor()
This method returns the count color
|
int |
getCurrentCell()
This method gets the currently selected cell
|
java.awt.Color |
getGridColor()
This method returns the grid color
|
int |
getRows()
This method returns the number of rows in the cell grid.
|
int |
getShow()
This method gets the show parameter.
|
void |
mouseDragged(java.awt.event.MouseEvent event) |
void |
mouseEntered(java.awt.event.MouseEvent event) |
void |
mouseExited(java.awt.event.MouseEvent event) |
void |
mouseMoved(java.awt.event.MouseEvent e)
This method handles the mouse move event.
|
void |
mousePressed(java.awt.event.MouseEvent event) |
void |
mouseReleased(java.awt.event.MouseEvent event) |
void |
paintComponent(java.awt.Graphics g)
This method paints the cell grid.
|
void |
reset()
This method resets the cell grid.
|
void |
setBallColor(java.awt.Color c)
This method sets the ball color.
|
void |
setCellCount(int[] c)
This method sets the counts for all of the cells.
|
void |
setCellCount(int i,
int k)
This method sets the count for an individual cell.
|
void |
setCells(int m)
This mtheod sets the number of cells.
|
void |
setCountColor(java.awt.Color c)
This method sets the count color.
|
void |
setCurrentCell(int c)
This method sets the currently selected cell
|
void |
setGridColor(java.awt.Color c)
This method sets the grid color.
|
void |
setShow(int i)
This method sets the show parameter.
|
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getAccessibleContext, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, paramString, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update, updateUI
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTree
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
public static final int COUNTS
public static final int BALL
public static final int NONE
public CellGrid(int m)
m
- the number of cells.public CellGrid()
public void paintComponent(java.awt.Graphics g)
paintComponent
in class javax.swing.JComponent
g
- the graphics context.public void setCellCount(int[] c)
c
- the array of cell counts.public void setCellCount(int i, int k)
i
- the index of the cell.k
- the cell count.public int[] getCellCount()
public int getCellCount(int i)
i
- the index of the cell.public void reset()
public void setCells(int m)
m
- the number of cells.public int getCells()
public void setGridColor(java.awt.Color c)
c
- the grid colorpublic java.awt.Color getGridColor()
public void setCountColor(java.awt.Color c)
c
- the count colorpublic java.awt.Color getCountColor()
public void setBallColor(java.awt.Color c)
c
- the ball colorpublic java.awt.Color getBallColor()
public void setShow(int i)
i
- the show parameterpublic int getShow()
public void setCurrentCell(int c)
c
- the current cellpublic int getCurrentCell()
public int getRows()
public int getColumns()
public int getBigColumns()
public void mouseMoved(java.awt.event.MouseEvent e)
mouseMoved
in interface java.awt.event.MouseMotionListener
e
- the mouse eventpublic void mouseEntered(java.awt.event.MouseEvent event)
public void mouseExited(java.awt.event.MouseEvent event)
public void mousePressed(java.awt.event.MouseEvent event)
public void mouseReleased(java.awt.event.MouseEvent event)
public void mouseDragged(java.awt.event.MouseEvent event)
mouseDragged
in interface java.awt.event.MouseMotionListener