org.concord.collisions.ui
Class PassiveElement

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--javax.swing.JComponent
                    |
                    +--org.concord.collisions.ui.PassiveElement
All Implemented Interfaces:
CCDraggable, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable
Direct Known Subclasses:
PassiveGrid, PassiveIcon, PassiveLine, PassiveOval, PassiveQTImage, PassiveQTMovie, PassiveRect, PassiveText

public abstract class PassiveElement
extends javax.swing.JComponent
implements CCDraggable

See Also:
Serialized Form

Inner classes inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Inner classes inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Inner classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent
 
Field Summary
 float ax
           
 float ay
           
protected  java.awt.Component component
           
protected  boolean draggable
           
protected  boolean moveable
           
protected  GUIPanel owner
           
protected  float posx
           
protected  float posy
           
protected  boolean pressedState
           
protected  boolean visible
           
 float vx
           
 float vy
           
 float x
           
 float y
           
 
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
PassiveElement()
           
 
Method Summary
 void addElemMouseListener(ElemMouseListener l)
          Add a mouse listener
static PassiveElement createGrid(int x, int y, int width, int height)
           
static PassiveElement createIcon(java.lang.String url, int x, int y)
           
static PassiveElement createIcon(java.lang.String url, int x, int y, int align)
           
static PassiveElement createIcon(java.lang.String url, int x, int y, int width, int height)
           
static PassiveElement createLine(int x0, int y0, int x1, int y1, int thickness)
           
static PassiveElement createLine(int x0, int y0, int x1, int y1, int thickness, int lenDash)
           
static PassiveElement createOval(int x, int y, int width, int height)
           
static PassiveElement createQTImage(java.lang.String url, int x, int y, java.awt.Image image, int alignment)
           
static PassiveElement createQTImage(java.lang.String url, int x, int y, int width, int height, java.awt.Image image, int alignment)
           
static PassiveElement createQTMovie(java.lang.String url, int x, int y)
           
static PassiveElement createQTMovie(java.lang.String url, int x, int y, java.awt.Component c)
           
static PassiveElement createQTMovie(java.lang.String url, int x, int y, int width, int height)
           
static PassiveElement createQTMovie(java.lang.String url, int x, int y, int width, int height, java.awt.Component c)
           
static PassiveElement createRectangle(int x, int y, int width, int height)
           
static PassiveElement createRectangle(int x, int y, int width, int height, boolean filled)
           
static PassiveElement createText(java.lang.String text, int x, int y)
           
 void dispose()
           
 void doDrag(CCCoordinateTuner tuner, int x, int y)
           
 void endDrag(CCCoordinateTuner tuner, int x, int y)
           
 float getAx()
           
 float getAy()
           
 java.awt.Color getBackColor()
           
 java.awt.Component getComponent()
           
 java.lang.Object getDraggableOwner()
           
 int getDragMode()
           
 java.awt.Color getForeColor()
           
 GUIPanel getOwner()
           
 float getVx()
           
 float getVy()
           
 boolean isDraggable()
           
 boolean isMoveable()
           
 boolean isPointInside(float px, float py)
           
 boolean isPointInside(java.awt.Point pt)
           
 boolean isPressedState()
           
 boolean isVisible()
          Determine if the PassiveElement is visible.
 void load(PassiveElement element)
           
 void move(float dt)
           
 void notifyMouseListeners(float x, float y, int evtType)
           
 void paint(java.awt.Graphics g)
           
 void paint(java.awt.Graphics g, java.awt.Graphics sg)
           
 void paint(java.awt.Graphics g, java.awt.Graphics sg, java.awt.image.ImageObserver observer)
           
protected abstract  void paintSpecific(java.awt.Graphics g, java.awt.Graphics sg)
           
protected  void paintSpecific(java.awt.Graphics g, java.awt.Graphics sg, java.awt.image.ImageObserver observer)
           
 boolean panelInfoSupport()
           
 void removeElemMouseListener(ElemMouseListener l)
          Remove a mouse listener
 void setAx(float ax)
           
 void setAy(float ay)
           
 void setBackColor(java.awt.Color backColor)
           
 void setComponent(java.awt.Component component)
           
 void setDraggable(boolean draggable)
           
 void setDragMode(int m)
           
 void setForeColor(java.awt.Color foreCcolor)
           
 void setInfoDrawer(CCInfoDrawer infoDrawer)
           
 void setLocation(int x, int y)
           
 void setLocation(java.awt.Point p)
           
 void setMoveable(boolean moveable)
           
 void setOwner(GUIPanel owner)
           
 void setPressedState(boolean pressedState)
           
 void setVisible(boolean visible)
          Set the visible state of the PassiveElement.
 void setVx(float vx)
           
 void setVy(float vy)
           
 void startDrag(int x, int y)
           
 
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, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getUIClassID, getVerifyInputWhenFocusTarget, getVisibleRect, getWidth, getX, getY, grabFocus, hasFocus, hide, isDoubleBuffered, isFocusCycleRoot, isFocusTraversable, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, paramString, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processFocusEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDoubleBuffered, setEnabled, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setUI, setVerifyInputWhenFocusTarget, unregisterKeyboardAction, update, updateUI
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getLayout, insets, invalidate, isAncestorOf, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setLayout, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, getBackground, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getInputContext, getInputMethodRequests, getLocale, getLocation, getLocationOnScreen, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, imageUpdate, inside, isDisplayable, isEnabled, isLightweight, isShowing, isValid, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setLocale, setName, setSize, setSize, show, show, size, toString, transferFocus
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

x

public float x

y

public float y

vx

public float vx

vy

public float vy

ax

public float ax

ay

public float ay

posx

protected float posx

posy

protected float posy

moveable

protected boolean moveable

draggable

protected boolean draggable

visible

protected boolean visible

pressedState

protected boolean pressedState

component

protected java.awt.Component component

owner

protected GUIPanel owner
Constructor Detail

PassiveElement

public PassiveElement()
Method Detail

setOwner

public void setOwner(GUIPanel owner)

getOwner

public GUIPanel getOwner()

load

public void load(PassiveElement element)

paint

public void paint(java.awt.Graphics g)
Overrides:
paint in class javax.swing.JComponent

paint

public void paint(java.awt.Graphics g,
                  java.awt.Graphics sg)

paint

public void paint(java.awt.Graphics g,
                  java.awt.Graphics sg,
                  java.awt.image.ImageObserver observer)

paintSpecific

protected abstract void paintSpecific(java.awt.Graphics g,
                                      java.awt.Graphics sg)

paintSpecific

protected void paintSpecific(java.awt.Graphics g,
                             java.awt.Graphics sg,
                             java.awt.image.ImageObserver observer)

createRectangle

public static PassiveElement createRectangle(int x,
                                             int y,
                                             int width,
                                             int height)

createRectangle

public static PassiveElement createRectangle(int x,
                                             int y,
                                             int width,
                                             int height,
                                             boolean filled)

createOval

public static PassiveElement createOval(int x,
                                        int y,
                                        int width,
                                        int height)

createLine

public static PassiveElement createLine(int x0,
                                        int y0,
                                        int x1,
                                        int y1,
                                        int thickness)

createLine

public static PassiveElement createLine(int x0,
                                        int y0,
                                        int x1,
                                        int y1,
                                        int thickness,
                                        int lenDash)

createIcon

public static PassiveElement createIcon(java.lang.String url,
                                        int x,
                                        int y,
                                        int width,
                                        int height)

createIcon

public static PassiveElement createIcon(java.lang.String url,
                                        int x,
                                        int y)

createIcon

public static PassiveElement createIcon(java.lang.String url,
                                        int x,
                                        int y,
                                        int align)

createText

public static PassiveElement createText(java.lang.String text,
                                        int x,
                                        int y)

createQTMovie

public static PassiveElement createQTMovie(java.lang.String url,
                                           int x,
                                           int y)

createQTMovie

public static PassiveElement createQTMovie(java.lang.String url,
                                           int x,
                                           int y,
                                           java.awt.Component c)

createQTMovie

public static PassiveElement createQTMovie(java.lang.String url,
                                           int x,
                                           int y,
                                           int width,
                                           int height)

createQTMovie

public static PassiveElement createQTMovie(java.lang.String url,
                                           int x,
                                           int y,
                                           int width,
                                           int height,
                                           java.awt.Component c)

createQTImage

public static PassiveElement createQTImage(java.lang.String url,
                                           int x,
                                           int y,
                                           java.awt.Image image,
                                           int alignment)

createQTImage

public static PassiveElement createQTImage(java.lang.String url,
                                           int x,
                                           int y,
                                           int width,
                                           int height,
                                           java.awt.Image image,
                                           int alignment)

createGrid

public static PassiveElement createGrid(int x,
                                        int y,
                                        int width,
                                        int height)

isPointInside

public boolean isPointInside(java.awt.Point pt)

isPointInside

public boolean isPointInside(float px,
                             float py)

setBackColor

public void setBackColor(java.awt.Color backColor)

getBackColor

public java.awt.Color getBackColor()

setForeColor

public void setForeColor(java.awt.Color foreCcolor)

getForeColor

public java.awt.Color getForeColor()

dispose

public void dispose()

move

public void move(float dt)

isMoveable

public boolean isMoveable()

setMoveable

public void setMoveable(boolean moveable)

setDraggable

public void setDraggable(boolean draggable)
Specified by:
setDraggable in interface CCDraggable

isDraggable

public boolean isDraggable()
Specified by:
isDraggable in interface CCDraggable

setPressedState

public void setPressedState(boolean pressedState)
Specified by:
setPressedState in interface CCDraggable

isPressedState

public boolean isPressedState()
Specified by:
isPressedState in interface CCDraggable

getVx

public float getVx()

getVy

public float getVy()

getAx

public float getAx()

getAy

public float getAy()

setVx

public void setVx(float vx)

setVy

public void setVy(float vy)

setAx

public void setAx(float ax)

setAy

public void setAy(float ay)

startDrag

public void startDrag(int x,
                      int y)
Specified by:
startDrag in interface CCDraggable

doDrag

public void doDrag(CCCoordinateTuner tuner,
                   int x,
                   int y)
Specified by:
doDrag in interface CCDraggable

endDrag

public void endDrag(CCCoordinateTuner tuner,
                    int x,
                    int y)
Specified by:
endDrag in interface CCDraggable

getDraggableOwner

public java.lang.Object getDraggableOwner()
Specified by:
getDraggableOwner in interface CCDraggable

panelInfoSupport

public boolean panelInfoSupport()
Specified by:
panelInfoSupport in interface CCDraggable

setInfoDrawer

public void setInfoDrawer(CCInfoDrawer infoDrawer)
Specified by:
setInfoDrawer in interface CCDraggable

isVisible

public boolean isVisible()
Determine if the PassiveElement is visible.
Overrides:
isVisible in class java.awt.Component
Returns:
true if PassiveElement is visible.

setVisible

public void setVisible(boolean visible)
Set the visible state of the PassiveElement.
Overrides:
setVisible in class javax.swing.JComponent
Parameters:
visible - if true, shows this object; otherwise, hides it

setComponent

public void setComponent(java.awt.Component component)

getComponent

public java.awt.Component getComponent()

setLocation

public void setLocation(int x,
                        int y)
Overrides:
setLocation in class java.awt.Component

setLocation

public void setLocation(java.awt.Point p)
Overrides:
setLocation in class java.awt.Component

notifyMouseListeners

public void notifyMouseListeners(float x,
                                 float y,
                                 int evtType)
Specified by:
notifyMouseListeners in interface CCDraggable

addElemMouseListener

public void addElemMouseListener(ElemMouseListener l)
Add a mouse listener
Parameters:
l - mouse listener to add

removeElemMouseListener

public void removeElemMouseListener(ElemMouseListener l)
Remove a mouse listener
Parameters:
l - mouse listener to remove

getDragMode

public int getDragMode()
Specified by:
getDragMode in interface CCDraggable

setDragMode

public void setDragMode(int m)
Specified by:
setDragMode in interface CCDraggable