net.sf.freecol.client.gui
Class GUI.GrayLayer

java.lang.Object
  extended by java.awt.Component
      extended by net.sf.freecol.client.gui.GUI.GrayLayer
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable
Enclosing class:
GUI

static class GUI.GrayLayer
extends java.awt.Component

Custom component to paint turn progress.

Currently the component darken out background using alpha channel and then paints the player's icon and wait message.


Nested Class Summary
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
private static int DEFAULT_FONT_SIZE
          Default font size for message text
private static int FONT_SIZE_DECREMENT
          Font size decrement for message text to reduce length
private  ImageLibrary imageLibrary
          Image library for icon lookup
private static java.awt.Color MASK_COLOR
          Color for graying out background component
private static int MAX_TEXT_WIDTH
          Maximum text width to show.
private  Player player
          Player object or null
 
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
GUI.GrayLayer(ImageLibrary imageLibrary)
           
 
Method Summary
 void paint(java.awt.Graphics g)
          Executes painting.
 void setPlayer(Player player)
          Set the player for which we paint.
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, deliverEvent, disable, disableEvents, dispatchEvent, doLayout, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAccessibleContext, getAlignmentX, getAlignmentY, getBackground, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentAt, getComponentAt, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeys, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMaximumSize, getMinimumSize, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, invalidate, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusCycleRoot, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, layout, list, list, list, list, list, locate, location, lostFocus, minimumSize, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, paramString, postEvent, preferredSize, prepareImage, prepareImage, print, printAll, processComponentEvent, processEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeys, setFocusTraversalKeysEnabled, setFont, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle, update, validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

MASK_COLOR

private static final java.awt.Color MASK_COLOR
Color for graying out background component


DEFAULT_FONT_SIZE

private static final int DEFAULT_FONT_SIZE
Default font size for message text

See Also:
Constant Field Values

FONT_SIZE_DECREMENT

private static final int FONT_SIZE_DECREMENT
Font size decrement for message text to reduce length

See Also:
Constant Field Values

MAX_TEXT_WIDTH

private static final int MAX_TEXT_WIDTH
Maximum text width to show. This is additional constraint to the component's bounds

See Also:
Constant Field Values

imageLibrary

private ImageLibrary imageLibrary
Image library for icon lookup


player

private Player player
Player object or null

Constructor Detail

GUI.GrayLayer

public GUI.GrayLayer(ImageLibrary imageLibrary)
Method Detail

paint

public void paint(java.awt.Graphics g)
Executes painting. The method shadows the background image, and paints the message with icon (if available) and text.

Overrides:
paint in class java.awt.Component
Parameters:
g - a Graphics value

setPlayer

public void setPlayer(Player player)
Set the player for which we paint. If the player is already set, then nothing happens, otherwise a repaint event is sent.

Parameters:
player - Player for status information
See Also:
paint(Graphics)