com.jme.widget.image
Class WidgetImage

java.lang.Object
  extended bycom.jme.scene.Spatial
      extended bycom.jme.widget.WidgetAbstractImpl
          extended bycom.jme.widget.image.WidgetImage
All Implemented Interfaces:
java.io.Serializable, Widget, WidgetMouseHandlerInterface
Direct Known Subclasses:
WidgetAnimatedImage

public class WidgetImage
extends WidgetAbstractImpl

ImageWidget

Since:
0.6
Version:
$$Id: WidgetImage.java,v 1.12 2004/10/14 01:23:08 mojomonkey Exp $$
Author:
Mike Kienenberger ImageWidget is a widget that draws a 2d image. The image may be scaled by four methods: SCALE_MODE_NONE - The image will not be scaled. SCALE_MODE_SIZE_TO_FIT - The image will be scaled to fill the size of the widget. Alignment is unused. SCALE_MODE_ABSOLUTE - The image is scaled vertically and horizontally by a percentage of the original size of the image. SCALE_MODE_RELATIVE - The image is scaled vertically and horizontally by a percentage of the size of the widget. KNOWN ISSUES: Drawing isn't clipped to the widget bounds. Alignment code doesn't work properly.
See Also:
Serialized Form

Field Summary
static int SCALE_MODE_ABSOLUTE
           
static int SCALE_MODE_NONE
           
static int SCALE_MODE_RELATIVE
           
static int SCALE_MODE_SIZE_TO_FIT
           
 
Fields inherited from class com.jme.widget.WidgetAbstractImpl
alignment, bgColor, border, cantOwnMouse, DEFAULT_BORDER_SIZE, DEFAULT_COMP_HEIGHT, DEFAULT_COMP_WIDTH, defaultBgColor, defaultFgColor, fgColor, localBound, notifierMouseButtonDown, notifierMouseButtonUp, notifierMouseDrag, notifierMouseEnter, notifierMouseExit, notifierMouseMove, opaque, preferredSize, textureCoords, viewRectangle, visible, zOrder
 
Fields inherited from class com.jme.scene.Spatial
currentStates, defaultStateList, forceCull, forceView, frustrumIntersects, geometricalControllers, lightCombineMode, localRotation, localScale, localTranslation, name, parent, queueDistance, renderQueueMode, renderStateList, textureCombineMode, worldBound, worldRotation, worldScale, worldTranslation
 
Constructor Summary
WidgetImage()
           
WidgetImage(Image image)
           
WidgetImage(Image image, WidgetAlignmentType alignment, int scaleMode)
           
 
Method Summary
protected  void alignCenter(Vector2f size, WidgetInsets insets)
           
protected  void alignEast(Vector2f size, WidgetInsets insets)
           
protected  void alignNorth(Vector2f size, WidgetInsets insets)
           
protected  void alignSouth(Vector2f size, WidgetInsets insets)
           
protected  void alignWest(Vector2f size, WidgetInsets insets)
           
 void doMouseButtonDown()
          doMouseButtonDown
 void doMouseButtonUp()
          doMouseButtonUp
 void draw(Renderer r)
          draw abstract method that handles drawing data to the renderer if it is geometry and passing the call to it's children if it is a node.
 void drawBounds(Renderer r)
          drawBounds abstract method that handles drawing bounds data to the renderer if it is geometry and passing the call to it's children if it is a node.
 void findCollisions(Spatial scene, CollisionResults results)
          checks this spatial against a second spatial, any collisions are stored in the results object.
 void findPick(Ray toTest, PickResults results)
           
 float getHorizontalScale()
           
 Image getImage()
           
 Vector2f getPreferredSize()
          getPreferredSize
 int getScaleMode()
           
 float getVerticalScale()
           
 boolean hasCollision(Spatial scene, boolean checkTriangles)
           
 void initWidgetRenderer()
          initWidgetRenderer
 void onDraw(Renderer r)
          onDraw checks the node with the camera to see if it should be culled, if not, the node's draw method is called.
 void setForceView(boolean value)
          setForceView will force the node to be rendered whether it's in the camera frustum or not.
 void setHorizontalScale(float f)
           
 void setImage(Image image)
           
 void setLocation(int x, int y)
          setLocation
 void setLocation(Vector2f at)
          setLocation
 void setPreferredSize(Vector2f size)
          setPreferredSize
 void setScaleMode(int mode)
           
 void setSize(int width, int height)
          setSize
 void setSize(Vector2f size)
          setSize
 void setVerticalScale(float f)
           
 void setX(int x)
          setX
 void setY(int y)
          setY
 
Methods inherited from class com.jme.widget.WidgetAbstractImpl
addMouseButtonDownObserver, addMouseButtonUpObserver, addMouseDragObserver, addMouseEnterObserver, addMouseExitObserver, addMouseMoveObserver, canClose, close, deleteMouseButtonDownObserver, deleteMouseButtonDownObservers, deleteMouseButtonUpObserver, deleteMouseButtonUpObservers, deleteMouseDragObserver, deleteMouseDragObservers, deleteMouseEnterObserver, deleteMouseEnterObservers, deleteMouseExitObserver, deleteMouseExitObservers, deleteMouseMoveObserver, deleteMouseMoveObservers, doAlignment, doMouseDrag, doMouseEnter, doMouseExit, doMouseMove, doParentLayout, getAbsoluteLocation, getAlignment, getBgColor, getBorder, getExtents, getFgColor, getHeight, getInputHandler, getLastWidgetUnderMouse, getLocation, getMouseInput, getMouseOwner, getNotifierMouseButtonDown, getNotifierMouseButtonUp, getNotifierMouseDrag, getNotifierMouseEnter, getNotifierMouseExit, getNotifierMouseMove, getOwner, getSize, getTextureCoords, getTopLevelComponent, getViewRectangle, getWidgetParent, getWidgetRenderer, getWidgetUnderMouse, getWidth, getX, getXOffset, getY, getYOffset, getZOrder, handleMouseButtonDown, handleMouseButtonUp, handleMouseDrag, handleMouseEnter, handleMouseExit, handleMouseMove, isApplyOffsetX, isApplyOffsetY, isCantOwnMouse, isCulled, isMouseInWidget, isOpaque, isTopLevel, isVisible, setAlignment, setApplyOffsetX, setApplyOffsetY, setBgColor, setBorder, setCantOwnMouse, setFgColor, setHeight, setInputHandler, setLastWidgetUnderMouse, setMouseOwner, setOwner, setPreferredSize, setTextureCoords, setViewRectangle, setVisible, setWidgetParent, setWidgetRenderer, setWidgetUnderMouse, setWidth, setZOrder, toString, updateWorldBound
 
Methods inherited from class com.jme.scene.Spatial
addController, applyDefaultStates, applyRenderState, calculateCollisions, calculatePick, clearCurrentState, clearCurrentStates, clearRenderState, getController, getControllers, getCurrentState, getLastFrustumIntersection, getLightCombineMode, getLocalRotation, getLocalScale, getLocalTranslation, getName, getParent, getRenderQueueMode, getRenderStateList, getTextureCombineMode, getWorldBound, getWorldRotation, getWorldScale, getWorldTranslation, isForceCulled, isForceView, onDrawBounds, propagateBoundToRoot, propagateStatesFromRoot, putClone, removeController, removeFromParent, setForceCull, setLightCombineMode, setLocalRotation, setLocalRotation, setLocalScale, setLocalScale, setLocalTranslation, setName, setParent, setRenderQueueMode, setRenderState, setTextureCombineMode, setWorldBound, updateCollisionTree, updateGeometricState, updateRenderState, updateRenderState, updateWorldData
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

SCALE_MODE_NONE

public static final int SCALE_MODE_NONE
See Also:
Constant Field Values

SCALE_MODE_SIZE_TO_FIT

public static final int SCALE_MODE_SIZE_TO_FIT
See Also:
Constant Field Values

SCALE_MODE_ABSOLUTE

public static final int SCALE_MODE_ABSOLUTE
See Also:
Constant Field Values

SCALE_MODE_RELATIVE

public static final int SCALE_MODE_RELATIVE
See Also:
Constant Field Values
Constructor Detail

WidgetImage

public WidgetImage()

WidgetImage

public WidgetImage(Image image)

WidgetImage

public WidgetImage(Image image,
                   WidgetAlignmentType alignment,
                   int scaleMode)
Method Detail

getImage

public Image getImage()

setImage

public void setImage(Image image)

onDraw

public void onDraw(Renderer r)
Description copied from class: Spatial
onDraw checks the node with the camera to see if it should be culled, if not, the node's draw method is called.

Overrides:
onDraw in class WidgetAbstractImpl
See Also:
Spatial.onDraw(com.jme.renderer.Renderer)

draw

public void draw(Renderer r)
Description copied from class: Spatial
draw abstract method that handles drawing data to the renderer if it is geometry and passing the call to it's children if it is a node.

Overrides:
draw in class WidgetAbstractImpl
See Also:
Spatial.draw(com.jme.renderer.Renderer)

drawBounds

public void drawBounds(Renderer r)
Description copied from class: Spatial
drawBounds abstract method that handles drawing bounds data to the renderer if it is geometry and passing the call to it's children if it is a node.

Specified by:
drawBounds in class Spatial
Parameters:
r - the renderer used for display.

getHorizontalScale

public float getHorizontalScale()

setHorizontalScale

public void setHorizontalScale(float f)

getVerticalScale

public float getVerticalScale()

setVerticalScale

public void setVerticalScale(float f)

getScaleMode

public int getScaleMode()

setScaleMode

public void setScaleMode(int mode)

getPreferredSize

public Vector2f getPreferredSize()
Description copied from interface: Widget
getPreferredSize

Specified by:
getPreferredSize in interface Widget
Overrides:
getPreferredSize in class WidgetAbstractImpl

doMouseButtonDown

public void doMouseButtonDown()
Description copied from interface: WidgetMouseHandlerInterface
doMouseButtonDown

Specified by:
doMouseButtonDown in interface WidgetMouseHandlerInterface
Overrides:
doMouseButtonDown in class WidgetAbstractImpl

doMouseButtonUp

public void doMouseButtonUp()
Description copied from interface: WidgetMouseHandlerInterface
doMouseButtonUp

Specified by:
doMouseButtonUp in interface WidgetMouseHandlerInterface
Overrides:
doMouseButtonUp in class WidgetAbstractImpl

setSize

public void setSize(Vector2f size)
Description copied from interface: Widget
setSize

Specified by:
setSize in interface Widget
Overrides:
setSize in class WidgetAbstractImpl

setSize

public void setSize(int width,
                    int height)
Description copied from interface: Widget
setSize

Specified by:
setSize in interface Widget
Overrides:
setSize in class WidgetAbstractImpl

setForceView

public void setForceView(boolean value)
Description copied from class: Spatial
setForceView will force the node to be rendered whether it's in the camera frustum or not.

Specified by:
setForceView in class Spatial
Parameters:
value - true to force viewing, false otherwise.

setPreferredSize

public void setPreferredSize(Vector2f size)
Description copied from interface: Widget
setPreferredSize

Specified by:
setPreferredSize in interface Widget
Overrides:
setPreferredSize in class WidgetAbstractImpl

alignCenter

protected void alignCenter(Vector2f size,
                           WidgetInsets insets)
Overrides:
alignCenter in class WidgetAbstractImpl

alignWest

protected void alignWest(Vector2f size,
                         WidgetInsets insets)
Overrides:
alignWest in class WidgetAbstractImpl

alignEast

protected void alignEast(Vector2f size,
                         WidgetInsets insets)
Overrides:
alignEast in class WidgetAbstractImpl

alignNorth

protected void alignNorth(Vector2f size,
                          WidgetInsets insets)
Overrides:
alignNorth in class WidgetAbstractImpl

alignSouth

protected void alignSouth(Vector2f size,
                          WidgetInsets insets)
Overrides:
alignSouth in class WidgetAbstractImpl

setLocation

public void setLocation(int x,
                        int y)
Description copied from interface: Widget
setLocation

Specified by:
setLocation in interface Widget
Overrides:
setLocation in class WidgetAbstractImpl

setLocation

public void setLocation(Vector2f at)
Description copied from interface: Widget
setLocation

Specified by:
setLocation in interface Widget
Overrides:
setLocation in class WidgetAbstractImpl

setX

public void setX(int x)
Description copied from interface: Widget
setX

Specified by:
setX in interface Widget
Overrides:
setX in class WidgetAbstractImpl

setY

public void setY(int y)
Description copied from interface: Widget
setY

Specified by:
setY in interface Widget
Overrides:
setY in class WidgetAbstractImpl

initWidgetRenderer

public void initWidgetRenderer()
Description copied from interface: Widget
initWidgetRenderer


findCollisions

public void findCollisions(Spatial scene,
                           CollisionResults results)
Description copied from class: Spatial
checks this spatial against a second spatial, any collisions are stored in the results object.

Specified by:
findCollisions in class Spatial
Parameters:
scene - the scene to test against.
results - the results of the collisions.

hasCollision

public boolean hasCollision(Spatial scene,
                            boolean checkTriangles)
Specified by:
hasCollision in class Spatial

findPick

public void findPick(Ray toTest,
                     PickResults results)
Specified by:
findPick in class Spatial