Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

plugins.Chess
Class JChessPanel  view JChessPanel download JChessPanel.java

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjavax.swing.JComponent
              extended byplugins.Chess.JChessPanel
All Implemented Interfaces:
plugins.Chess.event.BoardEventListener, java.util.EventListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable

public class JChessPanel
extends javax.swing.JComponent
implements plugins.Chess.event.BoardEventListener


Nested Class Summary
protected  class JChessPanel.ColorSetAction
           
 class JChessPanel.RedoAction
           
 class JChessPanel.RotateAction
           
 class JChessPanel.UndoAction
           
 
Nested classes inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
private  Board board
           
private  ColorSet colorSet
           
private  javax.swing.Action[] colorSetActions
           
private  int direction
           
static int DIRECTION_DOWN
           
static int DIRECTION_UP
           
private  boolean dragging
           
private  plugins.Chess.piece.Piece draggingPiece
           
private  int dragX
           
private  int dragY
           
private  java.awt.Cursor oldCursor
           
private  Field oldField
           
private  Player player
           
 javax.swing.Action RedoAction
           
 javax.swing.Action RotateAction
           
 javax.swing.Action UndoAction
           
 
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.Container
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
JChessPanel()
           
JChessPanel(Board board)
           
 
Method Summary
 void boardChanged(plugins.Chess.event.BoardEvent evt)
           
protected  ColorSet createDefaultColorSet()
           
protected  void createDefaultColorSetActions()
           
private  void drawField(java.awt.Graphics scratchGraphics, int column, int row, int cellWidth, int cellHeight)
           
 Board getBoard()
          Getter for property board.
 ColorSet getColorSet()
          Getter for property colorSet.
 javax.swing.Action[] getColorSetActions()
          Getter for property colorSetActions.
 int getColumn(int x)
           
 int getDirection()
          Getter for property direction.
 Player getPlayer()
          Getter for property player.
 int getRow(int y)
           
 void internalMouseDragged(java.awt.event.MouseEvent e)
           
 void internalMousePressed(java.awt.event.MouseEvent e)
          Invoked when a mouse button has been pressed on a component.
 void internalMouseReleased(java.awt.event.MouseEvent e)
          Invoked when a mouse button has been released on a component.
static void main(java.lang.String[] args)
           
protected  void paintBorder(java.awt.Graphics g)
          Paint the component's border.
protected  void paintComponent(java.awt.Graphics g)
          Paint the component's body.
 void redo(java.awt.event.ActionEvent e)
           
 void rotate(java.awt.event.ActionEvent e)
           
 void setBoard(Board board)
          Sets the Board model
 void setColorSet(ColorSet colorSet)
          Setter for property colorSet.
 void setDirection(int direction)
          Setter for property direction.
 void setPlayer(Player player)
          Setter for property player.
 void undo(java.awt.event.ActionEvent e)
           
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getAccessibleContext, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintChildren, paintImmediately, paintImmediately, paramString, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update, updateUI
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setLayout, swapComponents, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
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, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, 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, processMouseEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, 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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

dragging

private boolean dragging

draggingPiece

private plugins.Chess.piece.Piece draggingPiece

dragX

private int dragX

dragY

private int dragY

oldField

private Field oldField

oldCursor

private java.awt.Cursor oldCursor

colorSet

private ColorSet colorSet

board

private Board board

colorSetActions

private javax.swing.Action[] colorSetActions

RedoAction

public final javax.swing.Action RedoAction

UndoAction

public final javax.swing.Action UndoAction

RotateAction

public final javax.swing.Action RotateAction

DIRECTION_UP

public static final int DIRECTION_UP
See Also:
Constant Field Values

DIRECTION_DOWN

public static final int DIRECTION_DOWN
See Also:
Constant Field Values

direction

private int direction

player

private Player player
Constructor Detail

JChessPanel

public JChessPanel()

JChessPanel

public JChessPanel(Board board)
Method Detail

createDefaultColorSet

protected ColorSet createDefaultColorSet()

createDefaultColorSetActions

protected void createDefaultColorSetActions()

setBoard

public void setBoard(Board board)
Sets the Board model


paintBorder

protected void paintBorder(java.awt.Graphics g)
Description copied from class: javax.swing.JComponent
Paint the component's border. This usually means calling Border.paintBorder(java.awt.Component, java.awt.Graphics, int, int, int, int)>Border.paintBorder(java.awt.Component, java.awt.Graphics, int, int, int, int) 55 on the JComponent.border>JComponent.border 55 property, if it is non-null. You may override this if you wish to customize border painting behavior. The border is painted after the component's body, but before the component's children.


paintComponent

protected void paintComponent(java.awt.Graphics g)
Description copied from class: javax.swing.JComponent
Paint the component's body. This usually means calling ComponentUI.update(java.awt.Graphics, javax.swing.JComponent)>ComponentUI.update(java.awt.Graphics, javax.swing.JComponent) 55 on the JComponent.ui>JComponent.ui 55 property of the component, if it is non-null. You may override this if you wish to customize the component's body-painting behavior. The component's body is painted first, before the border and children.


drawField

private void drawField(java.awt.Graphics scratchGraphics,
                       int column,
                       int row,
                       int cellWidth,
                       int cellHeight)

getColumn

public int getColumn(int x)

getRow

public int getRow(int y)

internalMousePressed

public void internalMousePressed(java.awt.event.MouseEvent e)
Invoked when a mouse button has been pressed on a component.


internalMouseReleased

public void internalMouseReleased(java.awt.event.MouseEvent e)
Invoked when a mouse button has been released on a component.


internalMouseDragged

public void internalMouseDragged(java.awt.event.MouseEvent e)

boardChanged

public void boardChanged(plugins.Chess.event.BoardEvent evt)
Specified by:
boardChanged in interface plugins.Chess.event.BoardEventListener

getColorSet

public ColorSet getColorSet()
Getter for property colorSet.


setColorSet

public void setColorSet(ColorSet colorSet)
Setter for property colorSet.


getColorSetActions

public javax.swing.Action[] getColorSetActions()
Getter for property colorSetActions.


getBoard

public Board getBoard()
Getter for property board.


undo

public void undo(java.awt.event.ActionEvent e)

redo

public void redo(java.awt.event.ActionEvent e)

rotate

public void rotate(java.awt.event.ActionEvent e)

main

public static void main(java.lang.String[] args)

getDirection

public int getDirection()
Getter for property direction.


setDirection

public void setDirection(int direction)
Setter for property direction.


getPlayer

public Player getPlayer()
Getter for property player.


setPlayer

public void setPlayer(Player player)
Setter for property player.