|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
klaus.components.ChessBoard
public class ChessBoard
This component draws a chess board (what a surprise!).
Nested Class Summary |
---|
Nested classes/interfaces inherited from class javax.swing.JPanel |
---|
JPanel.AccessibleJPanel |
Nested classes/interfaces inherited from class javax.swing.JComponent |
---|
JComponent.AccessibleJComponent |
Nested classes/interfaces inherited from class java.awt.Container |
---|
Container.AccessibleAWTContainer |
Nested classes/interfaces inherited from class java.awt.Component |
---|
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy |
Field Summary | |
---|---|
private ChessBackend |
backend
The backend used by this board |
private Font |
coordsFont
|
private int |
dndXOffset
Position inside the piece (X) (drag'n'drop) |
private int |
dndXPOS
Do not draw the piece at this X position (drag'n'drop) |
private int |
dndYOffset
Position inside the piece (Y) (drag'n'drop) |
private int |
dndYPOS
Do not draw the piece at this Y position (drag'n'drop) |
private double |
fieldsize
|
private Vector<ChessBoardListener> |
listeners
|
private Result |
result
|
private int |
size
|
private boolean |
turned
Is the board turned? |
private int |
xposition
|
private int |
yposition
|
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 |
Fields inherited from interface java.awt.image.ImageObserver |
---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
---|---|
ChessBoard(ChessBackend chessBackend)
|
Method Summary | |
---|---|
void |
addChessBoardListener(ChessBoardListener listener)
|
private void |
calculateSize()
|
void |
fireListeners()
|
ChessBackend |
getBackend()
|
Party |
getParty()
|
private int |
getSquareX(int mouseX)
Convert the mouse coordinates to the coords of a square (X coord) |
private int |
getSquareY(int mouseY)
Convert the mouse coordinates to the coords of a square (Y coord) |
private int |
getXOnScreen(int squareX)
|
private int |
getYOnScreen(int squareY)
|
boolean |
isTurned()
|
void |
paintComponent(Graphics g)
Paint the board |
private String |
pieceToFileName(char piece)
|
void |
removeChessBoardListener(ChessBoardListener listener)
|
void |
setBackend(ChessBackend backend)
|
void |
setTurned(boolean turned)
|
Methods inherited from class javax.swing.JPanel |
---|
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private ChessBackend backend
private int dndXPOS
private int dndYPOS
private int dndXOffset
private int dndYOffset
private int size
private int xposition
private int yposition
private double fieldsize
private Font coordsFont
private Result result
private boolean turned
private Vector<ChessBoardListener> listeners
Constructor Detail |
---|
public ChessBoard(ChessBackend chessBackend)
Method Detail |
---|
private int getSquareX(int mouseX)
private int getSquareY(int mouseY)
private int getXOnScreen(int squareX)
private int getYOnScreen(int squareY)
private void calculateSize()
public void paintComponent(Graphics g)
paintComponent
in class JComponent
private String pieceToFileName(char piece)
public ChessBackend getBackend()
public Party getParty()
public void setBackend(ChessBackend backend)
public void addChessBoardListener(ChessBoardListener listener)
public void removeChessBoardListener(ChessBoardListener listener)
public void fireListeners()
public boolean isTurned()
public void setTurned(boolean turned)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |