Eclipse Draw2d
2.1

org.eclipse.draw2d
Class ImageFigure

java.lang.Object
  |
  +--org.eclipse.draw2d.Figure
        |
        +--org.eclipse.draw2d.ImageFigure
All Implemented Interfaces:
IFigure

public class ImageFigure
extends Figure

A Figure that simply contains an Image. Use this Figure, instead of a Label, when displaying Images without any accompanying text. Using Labels for displaying Images can stress your resources.


Nested Class Summary
 
Nested classes inherited from class org.eclipse.draw2d.Figure
Figure.FigureIterator
 
Nested classes inherited from class org.eclipse.draw2d.IFigure
IFigure.NoInsets
 
Field Summary
 
Fields inherited from class org.eclipse.draw2d.Figure
bgColor, border, bounds, fgColor, flags, font, MAX_FLAG, maxSize, minSize, NO_MANAGER, prefSize, toolTip
 
Fields inherited from interface org.eclipse.draw2d.IFigure
MAX_DIMENSION, MIN_DIMENSION, NO_INSETS
 
Constructor Summary
ImageFigure()
          Constructor
ImageFigure(Image image)
          Constructor
 
Method Summary
 Image getImage()
           
 Dimension getPreferredSize(int wHint, int hHint)
          Returns the size of the Image that this Figure displays; or (0,0) if no Image has been set yet.
protected  void paintFigure(Graphics graphics)
          Paints this Figure's primary representation, or background.
 void setAlignment(int flag)
          Sets the alignment of the Image within this Figure.
 void setImage(Image image)
          Sets the Image that this ImageFigure displays.
 
Methods inherited from class org.eclipse.draw2d.Figure
add, add, add, add, addAncestorListener, addFigureListener, addFocusListener, addKeyListener, addListener, addMouseListener, addMouseMotionListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, containsPoint, containsPoint, erase, findDescendantAtExcluding, findFigureAt, findFigureAt, findFigureAt, findFigureAtExcluding, findMouseEventTargetAt, findMouseEventTargetInDescendantsAt, fireMoved, firePropertyChange, firePropertyChange, firePropertyChange, getBackgroundColor, getBorder, getBounds, getChildren, getClientArea, getClientArea, getCursor, getFlag, getFont, getForegroundColor, getInsets, getLayoutManager, getListeners, getLocalBackgroundColor, getLocalForegroundColor, getLocation, getMaximumSize, getMinimumSize, getMinimumSize, getParent, getPreferredSize, getSize, getToolTip, getUpdateManager, handleFocusGained, handleFocusLost, handleKeyPressed, handleKeyReleased, handleMouseDoubleClicked, handleMouseDragged, handleMouseEntered, handleMouseExited, handleMouseHover, handleMouseMoved, handleMousePressed, handleMouseReleased, hasFocus, internalGetEventDispatcher, intersects, invalidate, invalidateTree, isEnabled, isFocusTraversable, isMouseEventTarget, isOpaque, isRequestFocusEnabled, isShowing, isValid, isValidationRoot, isVisible, layout, paint, paintBorder, paintChildren, paintClientArea, primTranslate, remove, removeAll, removeAncestorListener, removeFigureListener, removeFocusListener, removeKeyListener, removeListener, removeMouseListener, removeMouseMotionListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, revalidate, setBackgroundColor, setBorder, setBounds, setChildrenDirection, setChildrenEnabled, setChildrenOrientation, setConstraint, setCursor, setEnabled, setFlag, setFocusTraversable, setFont, setForegroundColor, setLayoutManager, setLocation, setMaximumSize, setMinimumSize, setOpaque, setParent, setPreferredSize, setPreferredSize, setRequestFocusEnabled, setSize, setSize, setToolTip, setValid, setVisible, translate, translateFromParent, translateToAbsolute, translateToParent, translateToRelative, useLocalCoordinates, validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ImageFigure

public ImageFigure()
Constructor


ImageFigure

public ImageFigure(Image image)
Constructor

Parameters:
image - The Image to be displayed
Method Detail

getImage

public Image getImage()
Returns:
The Image that this Figure displays

getPreferredSize

public Dimension getPreferredSize(int wHint,
                                  int hHint)
Returns the size of the Image that this Figure displays; or (0,0) if no Image has been set yet.

Specified by:
getPreferredSize in interface IFigure
Overrides:
getPreferredSize in class Figure
See Also:
Figure.getPreferredSize(int, int)

paintFigure

protected void paintFigure(Graphics graphics)
Description copied from class: Figure
Paints this Figure's primary representation, or background. Changes made to the graphics to the graphics current state will not affect the subsequent calls to Figure.paintClientArea(Graphics) and Figure.paintBorder(Graphics). Furthermore, it is safe to call graphics.restoreState() within this method, and doing so will restore the graphics to its original state upon entry.

Overrides:
paintFigure in class Figure
Parameters:
graphics - The Graphics used to paint
See Also:
Figure.paintFigure(Graphics)

setAlignment

public void setAlignment(int flag)
Sets the alignment of the Image within this Figure. The alignment comes into play when the ImageFigure is larger than the Image. The alignment could be any valid combination of the following:

Parameters:
flag - A constant indicating the alignment

setImage

public void setImage(Image image)
Sets the Image that this ImageFigure displays.

Parameters:
image - The Image to be displayed.

Eclipse Draw2d
2.1

Copyright (c) IBM Corp. and others 2000, 2003. All Rights Reserved.