edu.rice.comp440.driver
Class SwingDriver.BoardPanel
java.lang.Object
|
+--java.awt.Component
|
+--java.awt.Container
|
+--javax.swing.JComponent
|
+--javax.swing.JPanel
|
+--edu.rice.comp440.driver.SwingDriver.BoardPanel
- Enclosing class:
- SwingDriver
- public class SwingDriver.BoardPanel
- extends javax.swing.JPanel
- implements java.awt.event.MouseListener, java.awt.event.MouseMotionListener
- See Also:
- Serialized Form
Inner classes inherited from class javax.swing.JPanel |
javax.swing.JPanel.AccessibleJPanel |
Inner classes inherited from class javax.swing.JComponent |
javax.swing.JComponent.AccessibleJComponent |
Fields inherited from class javax.swing.JComponent |
accessibleContext,
listenerList,
TOOL_TIP_TEXT_KEY,
ui,
UNDEFINED_CONDITION,
WHEN_ANCESTOR_OF_FOCUSED_COMPONENT,
WHEN_FOCUSED,
WHEN_IN_FOCUSED_WINDOW |
Fields inherited from class java.awt.Component |
BOTTOM_ALIGNMENT,
CENTER_ALIGNMENT,
LEFT_ALIGNMENT,
RIGHT_ALIGNMENT,
TOP_ALIGNMENT |
Method Summary |
protected void |
drawBar(java.awt.Graphics2D g2)
|
protected void |
drawBar(java.awt.Graphics2D g2,
int location,
int player)
|
protected void |
drawDice(java.awt.Graphics2D g2)
|
protected void |
drawDragged(java.awt.Graphics g2)
|
protected void |
drawMan(java.awt.Graphics2D g2,
int location,
int num,
int player)
|
protected void |
drawMen(java.awt.Graphics2D g2)
|
protected void |
drawMen(java.awt.Graphics2D g2,
int location)
|
protected void |
drawOff(java.awt.Graphics2D g2)
|
protected void |
drawOff(java.awt.Graphics2D g2,
int location,
int player)
|
protected void |
drawText(java.awt.Graphics2D g2,
java.lang.String message,
int x,
int y)
|
java.awt.Dimension |
getPreferredSize()
|
protected int |
getSpike(int x,
int y)
|
protected boolean |
isBar(int x,
int y,
int player)
|
protected boolean |
isDice(int x,
int y)
|
protected boolean |
isSpike(int x,
int y)
|
void |
mouseClicked(java.awt.event.MouseEvent e)
|
void |
mouseDragged(java.awt.event.MouseEvent e)
|
void |
mouseEntered(java.awt.event.MouseEvent e)
|
void |
mouseExited(java.awt.event.MouseEvent e)
|
void |
mouseMoved(java.awt.event.MouseEvent e)
|
void |
mousePressed(java.awt.event.MouseEvent e)
|
void |
mouseReleased(java.awt.event.MouseEvent e)
|
void |
paint(java.awt.Graphics g)
|
Methods inherited from class javax.swing.JPanel |
getAccessibleContext,
getUIClassID,
paramString,
updateUI |
Methods inherited from class javax.swing.JComponent |
addAncestorListener,
addNotify,
addPropertyChangeListener,
addPropertyChangeListener,
addVetoableChangeListener,
computeVisibleRect,
contains,
createToolTip,
firePropertyChange,
firePropertyChange,
firePropertyChange,
firePropertyChange,
firePropertyChange,
firePropertyChange,
firePropertyChange,
firePropertyChange,
firePropertyChange,
fireVetoableChange,
getActionForKeyStroke,
getAlignmentX,
getAlignmentY,
getAutoscrolls,
getBorder,
getBounds,
getClientProperty,
getComponentGraphics,
getConditionForKeyStroke,
getDebugGraphicsOptions,
getGraphics,
getHeight,
getInsets,
getInsets,
getLocation,
getMaximumSize,
getMinimumSize,
getNextFocusableComponent,
getRegisteredKeyStrokes,
getRootPane,
getSize,
getToolTipLocation,
getToolTipText,
getToolTipText,
getTopLevelAncestor,
getVisibleRect,
getWidth,
getX,
getY,
grabFocus,
hasFocus,
isDoubleBuffered,
isFocusCycleRoot,
isFocusTraversable,
isLightweightComponent,
isManagingFocus,
isOpaque,
isOptimizedDrawingEnabled,
isPaintingTile,
isRequestFocusEnabled,
isValidateRoot,
paintBorder,
paintChildren,
paintComponent,
paintImmediately,
paintImmediately,
print,
printAll,
processComponentKeyEvent,
processFocusEvent,
processKeyEvent,
processMouseMotionEvent,
putClientProperty,
registerKeyboardAction,
registerKeyboardAction,
removeAncestorListener,
removeNotify,
removePropertyChangeListener,
removePropertyChangeListener,
removeVetoableChangeListener,
repaint,
repaint,
requestDefaultFocus,
requestFocus,
resetKeyboardActions,
reshape,
revalidate,
scrollRectToVisible,
setAlignmentX,
setAlignmentY,
setAutoscrolls,
setBackground,
setBorder,
setDebugGraphicsOptions,
setDoubleBuffered,
setEnabled,
setFont,
setForeground,
setMaximumSize,
setMinimumSize,
setNextFocusableComponent,
setOpaque,
setPreferredSize,
setRequestFocusEnabled,
setToolTipText,
setUI,
setVisible,
unregisterKeyboardAction,
update |
Methods inherited from class java.awt.Container |
add,
add,
add,
add,
add,
addContainerListener,
addImpl,
countComponents,
deliverEvent,
doLayout,
findComponentAt,
findComponentAt,
getComponent,
getComponentAt,
getComponentAt,
getComponentCount,
getComponents,
getLayout,
insets,
invalidate,
isAncestorOf,
layout,
list,
list,
locate,
minimumSize,
paintComponents,
preferredSize,
printComponents,
processContainerEvent,
processEvent,
remove,
remove,
removeAll,
removeContainerListener,
setCursor,
setLayout,
validate,
validateTree |
Methods inherited from class java.awt.Component |
action,
add,
addComponentListener,
addFocusListener,
addInputMethodListener,
addKeyListener,
addMouseListener,
addMouseMotionListener,
bounds,
checkImage,
checkImage,
coalesceEvents,
contains,
createImage,
createImage,
disable,
disableEvents,
dispatchEvent,
enable,
enable,
enableEvents,
enableInputMethods,
getBackground,
getBounds,
getColorModel,
getComponentOrientation,
getCursor,
getDropTarget,
getFont,
getFontMetrics,
getForeground,
getInputContext,
getInputMethodRequests,
getLocale,
getLocation,
getLocationOnScreen,
getName,
getParent,
getPeer,
getSize,
getToolkit,
getTreeLock,
gotFocus,
handleEvent,
hide,
imageUpdate,
inside,
isDisplayable,
isEnabled,
isLightweight,
isShowing,
isValid,
isVisible,
keyDown,
keyUp,
list,
list,
list,
location,
lostFocus,
mouseDown,
mouseDrag,
mouseEnter,
mouseExit,
mouseMove,
mouseUp,
move,
nextFocus,
paintAll,
postEvent,
prepareImage,
prepareImage,
processComponentEvent,
processInputMethodEvent,
processMouseEvent,
remove,
removeComponentListener,
removeFocusListener,
removeInputMethodListener,
removeKeyListener,
removeMouseListener,
removeMouseMotionListener,
repaint,
repaint,
repaint,
resize,
resize,
setBounds,
setBounds,
setComponentOrientation,
setDropTarget,
setLocale,
setLocation,
setLocation,
setName,
setSize,
setSize,
show,
show,
size,
toString,
transferFocus |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
WIDTH
public static final int WIDTH
HEIGHT
public static final int HEIGHT
BORDER
public static final int BORDER
SPIKE_WIDTH
public static final int SPIKE_WIDTH
SPIKE_HEIGHT
public static final int SPIKE_HEIGHT
MAN_WIDTH
public static final int MAN_WIDTH
MAN_HEIGHT
public static final int MAN_HEIGHT
OFFSET
public static final int OFFSET
BAR_WIDTH
public static final int BAR_WIDTH
MAX_MEN
public static final int MAX_MEN
DICE_RANDOM
public static final int DICE_RANDOM
BAR_WHITE_LOCATION
public static final int BAR_WHITE_LOCATION
BAR_BLACK_LOCATION
public static final int BAR_BLACK_LOCATION
random
protected java.util.Random random
board
protected java.awt.image.BufferedImage board
black
protected java.awt.Image black
white
protected java.awt.Image white
dice
protected java.awt.Image[][] dice
pressed
protected boolean pressed
pressedLocation
protected int pressedLocation
pressedX
protected int pressedX
pressedY
protected int pressedY
SwingDriver.BoardPanel
public SwingDriver.BoardPanel()
getPreferredSize
public java.awt.Dimension getPreferredSize()
- Overrides:
- getPreferredSize in class javax.swing.JComponent
paint
public void paint(java.awt.Graphics g)
- Overrides:
- paint in class javax.swing.JComponent
drawDragged
protected void drawDragged(java.awt.Graphics g2)
drawMen
protected void drawMen(java.awt.Graphics2D g2)
drawMen
protected void drawMen(java.awt.Graphics2D g2,
int location)
drawMan
protected void drawMan(java.awt.Graphics2D g2,
int location,
int num,
int player)
drawBar
protected void drawBar(java.awt.Graphics2D g2)
drawBar
protected void drawBar(java.awt.Graphics2D g2,
int location,
int player)
drawOff
protected void drawOff(java.awt.Graphics2D g2)
drawOff
protected void drawOff(java.awt.Graphics2D g2,
int location,
int player)
drawDice
protected void drawDice(java.awt.Graphics2D g2)
drawText
protected void drawText(java.awt.Graphics2D g2,
java.lang.String message,
int x,
int y)
isSpike
protected boolean isSpike(int x,
int y)
isDice
protected boolean isDice(int x,
int y)
isBar
protected boolean isBar(int x,
int y,
int player)
getSpike
protected int getSpike(int x,
int y)
mouseClicked
public void mouseClicked(java.awt.event.MouseEvent e)
- Specified by:
- mouseClicked in interface java.awt.event.MouseListener
mouseEntered
public void mouseEntered(java.awt.event.MouseEvent e)
- Specified by:
- mouseEntered in interface java.awt.event.MouseListener
mouseExited
public void mouseExited(java.awt.event.MouseEvent e)
- Specified by:
- mouseExited in interface java.awt.event.MouseListener
mouseMoved
public void mouseMoved(java.awt.event.MouseEvent e)
- Specified by:
- mouseMoved in interface java.awt.event.MouseMotionListener
mouseDragged
public void mouseDragged(java.awt.event.MouseEvent e)
- Specified by:
- mouseDragged in interface java.awt.event.MouseMotionListener
mousePressed
public void mousePressed(java.awt.event.MouseEvent e)
- Specified by:
- mousePressed in interface java.awt.event.MouseListener
mouseReleased
public void mouseReleased(java.awt.event.MouseEvent e)
- Specified by:
- mouseReleased in interface java.awt.event.MouseListener