|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Object
|
+--java.awt.Component
|
+--java.awt.Container
|
+--javax.swing.JComponent
|
+--javax.swing.JPanel
|
+--org.gjt.universe.gui.PlanetDiagramPanel
This class is a panel used to diagramatically represent a particular planetary body. A planetary body is a planet or a moon. The diagram represents its characteristics (e.g. surface, atmosphere, population, etc.) and any fleets which might be in orbit around it.
TO DO:
| Field Summary | |
private static java.lang.String |
BOMBARD_CMD_STR
|
private static java.lang.String |
COLONIZE_CMD_STR
|
private static java.lang.String |
DESTROY_CMD_STR
|
private static java.lang.String |
DETAILS_CMD_STR
|
private static java.lang.String |
INVADE_CMD_STR
|
private boolean |
isSelected
|
protected javax.swing.event.EventListenerList |
listenerList
|
private PlanetBase |
myPlanet
|
private CivID |
myViewerCivID
|
private static java.lang.String |
NEW_WINDOW_CMD_STR
|
private static java.awt.Dimension |
ourMinimumSize
|
private static java.lang.String |
SUBVERT_CMD_STR
|
| Fields inherited from class javax.swing.JPanel |
|
| Fields inherited from class javax.swing.JComponent |
accessibleContext, 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 | |
PlanetDiagramPanel(CivID viewer,
PlanetBase aPlanet)
Designated constructor. |
|
| Method Summary | |
void |
actionPerformed(java.awt.event.ActionEvent e)
|
void |
addItemListener(java.awt.event.ItemListener l)
|
private void |
drawAtmosphere(java.awt.Graphics2D g2d,
int boundsWidth,
int boundsHeight,
int surfaceDiameter,
int atmDiameter)
This method draws a representation of the planet's atmosphere such that its chemical composition and thickness can be visually discerned by the user. |
private void |
drawBorder(java.awt.Graphics2D g2d,
int boundsWidth,
int boundsHeight,
int borderDiameter,
int borderThickness)
This method draws a border around the planet if it is owned by a civilization and does nothing if not. |
(package private) void |
fireItemEvent(int selected)
|
PlanetID |
getPlanetID()
This method returns the ID of the planet which is being represented in the panel. |
java.lang.Object[] |
getSelectedObjects()
|
boolean |
isSelected()
Returns whether or not the panel is considered selected or not. |
void |
mouseClicked(java.awt.event.MouseEvent e)
|
void |
mouseEntered(java.awt.event.MouseEvent e)
|
void |
mouseExited(java.awt.event.MouseEvent e)
|
void |
mousePressed(java.awt.event.MouseEvent e)
Called whenever the user mouse clicks this panel. |
void |
mouseReleased(java.awt.event.MouseEvent e)
|
protected void |
paintComponent(java.awt.Graphics g)
This method has been extended to do the actual drawing of the planet. |
void |
removeItemListener(java.awt.event.ItemListener l)
|
void |
setPreferredSize(java.awt.Dimension newSize)
This inherited method has be overridden to automatically ensure that neither axis of the provided argument is less than the minimum size supported by this instance. |
void |
setSelected(boolean newValue)
Sets whether or not the panel is considered selected or not. |
| Methods inherited from class javax.swing.JPanel |
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI |
| 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, 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, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, 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, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update |
| 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, transferFocusBackward, 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, transferFocusUpCycle |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
private static java.awt.Dimension ourMinimumSize
private static final java.lang.String DETAILS_CMD_STR
private static final java.lang.String NEW_WINDOW_CMD_STR
private static final java.lang.String COLONIZE_CMD_STR
private static final java.lang.String SUBVERT_CMD_STR
private static final java.lang.String INVADE_CMD_STR
private static final java.lang.String BOMBARD_CMD_STR
private static final java.lang.String DESTROY_CMD_STR
private boolean isSelected
private PlanetBase myPlanet
private CivID myViewerCivID
protected javax.swing.event.EventListenerList listenerList
| Constructor Detail |
public PlanetDiagramPanel(CivID viewer,
PlanetBase aPlanet)
viewer - The ID of the civilization which is doing the viewing.aPlanet - The planetary body which is to be shown.| Method Detail |
public PlanetID getPlanetID()
public void setPreferredSize(java.awt.Dimension newSize)
setPreferredSize in class javax.swing.JComponentnewSize - The dimension to be adopted.protected void paintComponent(java.awt.Graphics g)
paintComponent in class javax.swing.JComponent
private void drawAtmosphere(java.awt.Graphics2D g2d,
int boundsWidth,
int boundsHeight,
int surfaceDiameter,
int atmDiameter)
g2d - Graphics context for drawingboundsWidth - The current width of this panel's boundsboundsHeight - The current height of this panel's boundssurfaceDiameter - The diameter of the circle drawn to represent the surface of the planetatmDiameter - The diameter of the circle drawn to represent the planet's atmosphere (slightly larger than surfaceDiameter)
private void drawBorder(java.awt.Graphics2D g2d,
int boundsWidth,
int boundsHeight,
int borderDiameter,
int borderThickness)
g2d - Graphics context for drawingboundsWidth - The current width of this panel's boundsboundsHeight - The current height of this panel's boundsborderDiameter - The diameter of the border circleborderThickness - The thickness that should be used to draw the border.public boolean isSelected()
public void setSelected(boolean newValue)
If the new value differs from the current one then all registered listeners will be notified in the change in state.
newValue - True if the panel should be considered selected. False otherwise.public void mousePressed(java.awt.event.MouseEvent e)
mousePressed in interface java.awt.event.MouseListenerpublic void mouseClicked(java.awt.event.MouseEvent e)
mouseClicked in interface java.awt.event.MouseListenerpublic void mouseReleased(java.awt.event.MouseEvent e)
mouseReleased in interface java.awt.event.MouseListenerpublic void mouseExited(java.awt.event.MouseEvent e)
mouseExited in interface java.awt.event.MouseListenerpublic void mouseEntered(java.awt.event.MouseEvent e)
mouseEntered in interface java.awt.event.MouseListenerpublic void actionPerformed(java.awt.event.ActionEvent e)
actionPerformed in interface java.awt.event.ActionListenerpublic java.lang.Object[] getSelectedObjects()
getSelectedObjects in interface java.awt.ItemSelectablepublic void addItemListener(java.awt.event.ItemListener l)
addItemListener in interface java.awt.ItemSelectablepublic void removeItemListener(java.awt.event.ItemListener l)
removeItemListener in interface java.awt.ItemSelectablevoid fireItemEvent(int selected)
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||