Class Chit
java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
net.sf.colossus.gui.Chit
- All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible
- Direct Known Subclasses:
GUIBattleChit, Marker, MovementDie, StrikeDie
Class Chit implements the GUI for a Titan chit representing
either a character or a legion.
TODO offer constructors using the Legion instead of strings
TODO consider splitting into LegionChit and CreatureChit
TODO Important: All creature (and marker) related Chits should get an
option argument in order to be able to ask for options like
"marker in players original color or now-owning-player's-color
and "angel in traditionl blue or in actual players color".
- Author:
- David Ripton, Romain Dolbeau
-
Nested Class Summary
Nested classes/interfaces inherited from class JPanel
JPanel.AccessibleJPanelNested classes/interfaces inherited from class JComponent
JComponent.AccessibleJComponentNested classes/interfaces inherited from class Container
Container.AccessibleAWTContainerNested classes/interfaces inherited from class Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate booleanFlag to paint a border around the chit.private Colorprivate final Imageprivate Image(package private) final Clientprivate booleanFlag to mark chit as dead and paint it with an "X" through it.private final Stringprotected final booleanFlag to paint the chit upside-down.private static final Logger(package private) static final BasicStroke(package private) final IOptionsprivate final boolean(package private) Rectangleprivate static final BasicStrokeFields inherited from class JComponent
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOWFields inherited from class Component
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENTFields inherited from interface ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH -
Constructor Summary
ConstructorsModifierConstructorDescription(package private)P l a i n C o n s t r u c t o r s(package private)privateChit(int scale, String idPerhapsWithColor, boolean inverted, boolean dubious, boolean dubiousAsBlank, String[] overlays, Client client, IOptions options) (package private)Chit(int scale, String id, boolean inverted, boolean dubious, boolean dubiousAsBlank, Client client) (package private)(package private)(package private)Chit(int scale, CreatureType creatureType) -
Method Summary
Modifier and TypeMethodDescriptiongetId()private static Imageprivate static Imageint(package private) booleanisDead()static booleanisMarkerId(String id) static ChitnewCreatureChit(int scale, String id) Factory method for creatures, based on image names TODO try to get rid of the string bases Creature chitsstatic ChitnewCreatureChit(int scale, CreatureType type) Factory method for creatures, based on CreatureTypestatic ChitnewDiceChit(int scale, String markerId) Factory method for creatures, based on markerIdstatic ChitnewSymbolChit(int scale, String id) Factory method for icons representing e.g.void(package private) voidrescale(int scale) (package private) voidsetBorder(boolean border) (package private) voidsetBorderColor(Color borderColor) (package private) voidsetDead(boolean dead) voidsetLocation(Point point) (package private) voidtoString()Methods inherited from class JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUIMethods inherited from class JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, 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, getNextFocusableComponent, getPopupLocation, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, 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, updateMethods inherited from class Container
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, validateTreeMethods inherited from class 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, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, 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, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, 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, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, transferFocus, transferFocusBackward, transferFocusUpCycle
-
Field Details
-
LOGGER
-
bufferedImage
-
bufferedInvertedImage
-
rect
Rectangle rect -
client
-
options
-
dead
private boolean deadFlag to mark chit as dead and paint it with an "X" through it. -
border
private boolean borderFlag to paint a border around the chit. -
borderColor
-
playerColoredAngel
private final boolean playerColoredAngel -
inverted
protected final boolean invertedFlag to paint the chit upside-down. -
id
-
oneWide
-
threeWide
-
-
Constructor Details
-
Chit
Chit(int scale, String id) P l a i n C o n s t r u c t o r s -
Chit
Chit(int scale, CreatureType creatureType) -
Chit
-
Chit
-
Chit
Chit(int scale, String id, boolean inverted, boolean dubious) -
Chit
-
Chit
private Chit(int scale, String idPerhapsWithColor, boolean inverted, boolean dubious, boolean dubiousAsBlank, String[] overlays, Client client, IOptions options) - Parameters:
idPerhapsWithColor- CreatureType id, markerId, or filename of some picture denoting some symbol (for HazardEffects). For Markers, Titans and Angels could be of form- and then they will be painted in that color (e.g. captured markers) options- TODO
-
-
Method Details
-
newCreatureChit
-
newCreatureChit
Factory method for creatures, based on CreatureType- Parameters:
scale-type-- Returns:
- The newly created CreatureChit
-
newDiceChit
-
newSymbolChit
-
isMarkerId
-
getTitanPower
public int getTitanPower() -
getImage
-
getImage
-
getId
-
toString
-
rescale
void rescale(int scale) -
paintComponent
- Overrides:
paintComponentin classJComponent
-
setLocation
- Overrides:
setLocationin classComponent
-
getBounds
-
getCenter
-
getPreferredSize
- Overrides:
getPreferredSizein classJComponent
-
getMinimumSize
- Overrides:
getMinimumSizein classJComponent
-
getMaximumSize
- Overrides:
getMaximumSizein classJComponent
-
isDead
boolean isDead() -
setDead
void setDead(boolean dead) -
toggleDead
void toggleDead() -
setBorder
void setBorder(boolean border) -
setBorderColor
-