Draw2D v2.0

org.eclipse.draw2d
Class Figure

java.lang.Object
  |
  +--org.eclipse.draw2d.Figure
All Implemented Interfaces:
IFigure
Direct Known Subclasses:
Clickable, Dock, Label, LabeledContainer, LightweightSystem.RootFigure, Panel, ScrollBar, ScrollPane, Shape, Thumbnail, org.eclipse.draw2d.TransparentFigure, Viewport

public class Figure
extends Object
implements IFigure

The base implementation for graphical figures.


Inner Class Summary
static class Figure.FigureIterator
           
 
Inner classes inherited from class org.eclipse.draw2d.IFigure
IFigure.NoInsets
 
Field Summary
protected  Color bgColor
           
protected  Border border
           
protected  Rectangle bounds
           
protected  Color fgColor
           
protected  int flags
           
protected  Font font
           
protected static int MAX_FLAG
           
protected  Dimension maxSize
           
protected  Dimension minSize
           
protected static UpdateManager NO_MANAGER
           
protected  Dimension prefSize
           
protected  IFigure toolTip
           
 
Fields inherited from interface org.eclipse.draw2d.IFigure
MAX_DIMENSION, MIN_DIMENSION, NO_INSETS
 
Constructor Summary
Figure()
           
 
Method Summary
 void add(IFigure figure)
          Adds the given Figure as a child of this Figure.
 void add(IFigure figure, int index)
          Adds the given Figure as a child of this Figure at the given index.
 void add(IFigure figure, Object constraint)
          Adds the given figure as a child of this figure, with the given constraint.
 void add(IFigure figure, Object constraint, int index)
          Adds the given figure as a child of this figure at the given index, with the given constraint.
 void addAncestorListener(AncestorListener ancestorListener)
          Registers the given listener as an AncestorListener of this IFigure.
 void addFigureListener(FigureListener listener)
          Registers the given listener as a FigureListener of this IFigure.
 void addFocusListener(FocusListener listener)
          Registers the given listener as a FocusListener of this IFigure.
 void addKeyListener(KeyListener listener)
          Registers the given listener as a KeyListner of this IFigure.
protected  void addListener(Class clazz, Object listener)
           
 void addMouseListener(MouseListener l)
          Registers the given listener as a MouseListener of this IFigure.
 void addMouseMotionListener(MouseMotionListener l)
          Registers the given listener as a MouseMotionListener of this IFigure.
 void addNotify()
          Called after the receiver's parent has been set and it has been added to its parent.
 void addPropertyChangeListener(PropertyChangeListener l)
          Registers the given listener as a PropertyChangeListener of this IFigure.
 void addPropertyChangeListener(String property, PropertyChangeListener listener)
          Registers the given listener as a PropertyChangeListener of this IFigure, interested only in the given property.
 boolean containsPoint(int x, int y)
          Returns true if the point (x, y) is contained within this IFigures bounds.
 boolean containsPoint(Point p)
          This method is final.
 void erase()
          Erases this IFigure.
protected  IFigure findDescendantAtExcluding(int x, int y, Collection c)
          Returns a descendant of this Figure such that the Figure returned contains the point <x, y>, and is not a member of the Collection c.
 IFigure findFigureAt(int x, int y)
          Returns the figure at the specified location.
 IFigure findFigureAt(Point pt)
          Returns the figure at the specified location.
 IFigure findFigureAtExcluding(int x, int y, Collection c)
          Returns the figure at the specified location, excluding any figures in collection.
 IFigure findMouseEventTargetAt(int x, int y)
          Returns the figure located at the given location which will accept mouse events.
protected  void fireMoved()
          Notifies any FigureListeners listening to this Figure that it has moved.
protected  void firePropertyChange(String property, boolean old, boolean current)
          Notifies any PropertyChangeListeners listening to this figure that the boolean property with id property has changed.
protected  void firePropertyChange(String property, int old, int current)
          Notifies any PropertyChangeListeners listening to this figure that the integer property with id property has changed.
protected  void firePropertyChange(String property, Object old, Object current)
          Notifies any PropertyChangeListeners listening to this figure that the Object property with id property has changed.
 Color getBackgroundColor()
          Returns the background color.
 Border getBorder()
          Returns the current border by reference.
 Rectangle getBounds()
          Returns the smallest rectangle completely enclosing the figure.
 List getChildren()
          Returns an unmodifiable collection of children by reference.
 Rectangle getClientArea()
          Returns the rectangular area within this Figure's bounds in which children will be placed (via LayoutManagers) and the painting of children will be clipped.
 Rectangle getClientArea(Rectangle rect)
          Modifies the given Rectangle so that it represents this Figure's client area, then returns it.
 Cursor getCursor()
          Returns the cursor used when the mouse is over this figure.
protected  boolean getFlag(int flag)
           
 Font getFont()
          Returns the current font by reference.
 Color getForegroundColor()
          Returns the foreground color.
 Insets getInsets()
          Returns the current Insets.
 LayoutManager getLayoutManager()
          Returns the current LayoutManager by reference.
protected  Iterator getListeners(Class clazz)
          Returns an Iterator containing the listeners of type clazz that are listening to this Figure.
 Point getLocation()
          Returns the top-left corner of this Figure's bounds.
 Dimension getMaximumSize()
          Returns a hint indicating the largest desireable size for the figure.
 Dimension getMinimumSize()
          Returns a hint indicating the smallest desireable size for the figure.
 IFigure getParent()
          Returns the current Parent.
 Dimension getPreferredSize()
          Returns the desireable size for this figure.
 Dimension getPreferredSize(int wHint, int hHint)
          Returns the preferred size this Figure should be, using width and height hints.
 Dimension getSize()
          Returns the current size of this figure.
 IFigure getToolTip()
          Returns an IFigure that is the tooltip for this Figure.
 UpdateManager getUpdateManager()
          Returns the UpdateManager for this figure by reference.
 void handleFocusGained(FocusEvent fe)
          Notifies FocusListeners that this figure has gained focus.
 void handleFocusLost(FocusEvent fe)
          Notifies FocusListeners that this figure has lost focus.
 void handleKeyPressed(KeyEvent e)
          Notifies KeyListeners that this figure has lost focus.
 void handleKeyReleased(KeyEvent e)
          Notifies KeyListeners that this figure has lost focus.
 void handleMouseDoubleClicked(MouseEvent e)
          Notifies MouseListeners that the mouse has been double-clicked on this figure.
 void handleMouseDragged(MouseEvent e)
          Notifies MouseMotionListeners that the mouse has been dragged over this figure.
 void handleMouseEntered(MouseEvent e)
          Notifies MouseMotionListeners that the mouse has entered this figure.
 void handleMouseExited(MouseEvent e)
          Notifies MouseMotionListeners that the mouse has exited this figure.
 void handleMouseHover(MouseEvent e)
          Notifies MouseMotionListeners that the mouse has hovered over this figure.
 void handleMouseMoved(MouseEvent e)
          Notifies MouseMotionListeners that the mouse has moved over this figure.
 void handleMousePressed(MouseEvent e)
          Notifies MouseListeners that a mouse button has been pressed while over this figure.
 void handleMouseReleased(MouseEvent e)
          Notifies MouseListeners that a mouse button has been released while over this figure.
 boolean hasFocus()
          Returns true if this figure has focus.
 EventDispatcher internalGetEventDispatcher()
          This method is for internal purposes only and should not be called.
 boolean intersects(Rectangle r)
          Returns true if this figure needs to paint anywhere inside r.
 void invalidate()
          Invalidates this figure.
 boolean isEnabled()
          Returns true if this figure is enabled.
 boolean isFocusTraversable()
          Returns true if this figure can gain focus on a TraverseEvent.
protected  boolean isMouseEventTarget()
          Returns true if this figure can receive MouseEvents.
 boolean isOpaque()
          Returns true if this figure is opaque.
 boolean isRequestFocusEnabled()
          Returns true if this figure can receive focus on a call to requestFocus().
protected  boolean isValid()
          Returns true if this figure is valid.
protected  boolean isValidationRoot()
          Returns true if revalidating this figure does not require revalidating its parent.
 boolean isVisible()
          Returns true if this figure is visible.
protected  void layout()
          Lays out this figure using its LayoutManager.
 void paint(Graphics graphics)
          Paints this figure, including its border and children.
protected  void paintBorder(Graphics graphics)
          Paints the border associated with this figure, if one exists.
protected  void paintChildren(Graphics g)
          Paint this Figure's children.
protected  void paintClientArea(Graphics g)
          Paints this Figure's client area.
protected  void paintFigure(Graphics graphics)
          Paints this Figure's primary representation, or background.
protected  void primTranslate(int dx, int dy)
          Translates this figure's bounds, without firing a move.
 void remove(IFigure figure)
          Removes the given figure from this figure's list of children.
 void removeAll()
          Removes all children from this Figure.
 void removeAncestorListener(AncestorListener listener)
          Unregisters the given listener, so that it will no longer receive notification of ancestor events.
 void removeFigureListener(FigureListener listener)
          Unregisters the given listener, so that it will no longer receive notification of figure events.
 void removeFocusListener(FocusListener listener)
          Unregisters the given listener, so that it will no longer receive notification of focus events.
protected  void removeListener(Class clazz, Object listener)
          Removes listener from clazz.
 void removeMouseListener(MouseListener listener)
          Unregisters the given listener, so that it will no longer receive notification of mouse events.
 void removeMouseMotionListener(MouseMotionListener listener)
          Unregisters the given listener, so that it will no longer receive notification of mouse motion events.
 void removeNotify()
          Called before this figure is removed from its parent.
 void removePropertyChangeListener(PropertyChangeListener listener)
          Unregisters the given listener, so that it will no longer receive notification of any property changes.
 void removePropertyChangeListener(String property, PropertyChangeListener listener)
          Unregisters the given listener, so that it will no longer receive notification of changes in the given property.
 void repaint()
          Repaints this figure.
 void repaint(int x, int y, int w, int h)
          Repaints the rectangular area within this figure whose upper-left corner is located at the point (x,y) and whose width and height are w and h, respectively.
 void repaint(Rectangle r)
          Repaints the area of this figure represented by the given Rectangle.
 void requestFocus()
          Requests focus from the EventDispatcher.
 void revalidate()
          Revalidates this figure.
 void setBackgroundColor(Color bg)
          Sets the background color.
 void setBorder(Border border)
          Sets the border.
 void setBounds(Rectangle r)
          Sets the bounds of this Figure to the Rectangle r.
protected  void setChildrenDirection(int dir)
          Sets the direction of any Orientable children.
protected  void setChildrenEnabled(boolean value)
          Sets all childrens' enabled property to value.
protected  void setChildrenOrientation(int orientation)
          Sets the orientation of any Orientable children.
 void setConstraint(IFigure child, Object constraint)
          Deprecated. Sets the constraint of a previously added child.
 void setCursor(Cursor cursor)
          Sets the cursor.
 void setEnabled(boolean value)
          Sets this figure to be enabled.
protected  void setFlag(int flag, boolean value)
          Sets the given flag to the given value.
 void setFocusTraversable(boolean focusTraversable)
          Sets the ability for this figure to gain focus on a TraverseEvent.
 void setFont(Font f)
          Sets the font.
 void setForegroundColor(Color fg)
          Sets the foreground color.
 void setLayoutManager(LayoutManager manager)
          Sets the LayoutManager.
 void setLocation(Point p)
          Sets the location of this figure.
 void setMaximumSize(Dimension d)
          Sets the maximum size this figure can be.
 void setMinimumSize(Dimension d)
          Sets the minimum size this figure can be.
 void setOpaque(boolean opaque)
          Sets this figure to be opaque if isOpaque is true and transparent if isOpaque is false.
 void setParent(IFigure p)
          Sets this figure's parent.
 void setPreferredSize(Dimension size)
          Sets this figure's preferred size.
 void setPreferredSize(int w, int h)
          Sets the preferred size of this figure.
 void setRequestFocusEnabled(boolean requestFocusEnabled)
          Sets the ability for this Figure to gain focus on a call to requestFocus().
 void setSize(Dimension d)
          Sets this figure's size.
 void setSize(int w, int h)
          Sets the current size of this figure.
 void setToolTip(IFigure f)
          The passed Figure f will appear on a mouse hover over this Figure.
 void setUpdateManager(UpdateManager updateManager)
          Sets the UpdateManager.
 void setValid(boolean valid)
          Sets this figure to be valid if valid is true, and invalid otherwise.
 void setVisible(boolean visible)
          Sets this figure's visibility.
 void translate(int x, int y)
          Moves this figure x pixels horizontally and y pixels vertically.
 void translateFromParent(Translatable t)
          Translates a Translatable from this figure's parent's coordinates to this figure's local coordinates.
 void translateToAbsolute(Translatable t)
          Translates a Translatable from this figure's coordinates to the top-most parent's coordinates.
 void translateToParent(Translatable t)
          Translates a Translatable from this figure's coordinates to its parent's coordinates.
 void translateToRelative(Translatable t)
          Translates a Translatable from the top-most parent's coordinates to local coordinates.
protected  boolean useLocalCoordinates()
          Returns true if this figure uses local coordinates.
 void validate()
          Causes this figure to layout itself, as well as its children.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MAX_FLAG

protected static int MAX_FLAG

bounds

protected Rectangle bounds

flags

protected int flags

prefSize

protected Dimension prefSize

minSize

protected Dimension minSize

maxSize

protected Dimension maxSize

font

protected Font font

bgColor

protected Color bgColor

fgColor

protected Color fgColor

border

protected Border border

toolTip

protected IFigure toolTip

NO_MANAGER

protected static final UpdateManager NO_MANAGER
Constructor Detail

Figure

public Figure()
Method Detail

add

public final void add(IFigure figure,
                      Object constraint)
Adds the given figure as a child of this figure, with the given constraint.
Specified by:
add in interface IFigure
Since:
2.0

add

public void add(IFigure figure,
                Object constraint,
                int index)
Adds the given figure as a child of this figure at the given index, with the given constraint.
Specified by:
add in interface IFigure
Since:
2.0

add

public final void add(IFigure figure)
Adds the given Figure as a child of this Figure.
Specified by:
add in interface IFigure
Since:
2.0

add

public final void add(IFigure figure,
                      int index)
Adds the given Figure as a child of this Figure at the given index.
Specified by:
add in interface IFigure
Since:
2.0

addAncestorListener

public void addAncestorListener(AncestorListener ancestorListener)
Description copied from interface: IFigure
Registers the given listener as an AncestorListener of this IFigure.
Specified by:
addAncestorListener in interface IFigure

addFigureListener

public void addFigureListener(FigureListener listener)
Description copied from interface: IFigure
Registers the given listener as a FigureListener of this IFigure.
Specified by:
addFigureListener in interface IFigure

addFocusListener

public void addFocusListener(FocusListener listener)
Description copied from interface: IFigure
Registers the given listener as a FocusListener of this IFigure.
Specified by:
addFocusListener in interface IFigure

addKeyListener

public void addKeyListener(KeyListener listener)
Description copied from interface: IFigure
Registers the given listener as a KeyListner of this IFigure.
Specified by:
addKeyListener in interface IFigure

addListener

protected void addListener(Class clazz,
                           Object listener)

addMouseListener

public void addMouseListener(MouseListener l)
Description copied from interface: IFigure
Registers the given listener as a MouseListener of this IFigure.
Specified by:
addMouseListener in interface IFigure

addMouseMotionListener

public void addMouseMotionListener(MouseMotionListener l)
Description copied from interface: IFigure
Registers the given listener as a MouseMotionListener of this IFigure.
Specified by:
addMouseMotionListener in interface IFigure

addNotify

public void addNotify()
Called after the receiver's parent has been set and it has been added to its parent.
Specified by:
addNotify in interface IFigure
Since:
2.0

addPropertyChangeListener

public void addPropertyChangeListener(String property,
                                      PropertyChangeListener listener)
Description copied from interface: IFigure
Registers the given listener as a PropertyChangeListener of this IFigure, interested only in the given property.
Specified by:
addPropertyChangeListener in interface IFigure

addPropertyChangeListener

public void addPropertyChangeListener(PropertyChangeListener l)
Description copied from interface: IFigure
Registers the given listener as a PropertyChangeListener of this IFigure.
Specified by:
addPropertyChangeListener in interface IFigure

containsPoint

public final boolean containsPoint(Point p)
This method is final. Override containsPoint(int, int)
Specified by:
containsPoint in interface IFigure
Since:
2.0

containsPoint

public boolean containsPoint(int x,
                             int y)
Description copied from interface: IFigure
Returns true if the point (x, y) is contained within this IFigures bounds.
Specified by:
containsPoint in interface IFigure

erase

public void erase()
Description copied from interface: IFigure
Erases this IFigure.
Specified by:
erase in interface IFigure

findDescendantAtExcluding

protected IFigure findDescendantAtExcluding(int x,
                                            int y,
                                            Collection c)
Returns a descendant of this Figure such that the Figure returned contains the point <x, y>, and is not a member of the Collection c. Returns null if none found.

findFigureAt

public final IFigure findFigureAt(Point pt)
Description copied from interface: IFigure
Returns the figure at the specified location. May return this or null.
Specified by:
findFigureAt in interface IFigure

findFigureAt

public final IFigure findFigureAt(int x,
                                  int y)
Description copied from interface: IFigure
Returns the figure at the specified location. May return this or null.
Specified by:
findFigureAt in interface IFigure

findFigureAtExcluding

public IFigure findFigureAtExcluding(int x,
                                     int y,
                                     Collection c)
Description copied from interface: IFigure
Returns the figure at the specified location, excluding any figures in collection. May return this or null.
Specified by:
findFigureAtExcluding in interface IFigure

findMouseEventTargetAt

public IFigure findMouseEventTargetAt(int x,
                                      int y)
Description copied from interface: IFigure
Returns the figure located at the given location which will accept mouse events.
Specified by:
findMouseEventTargetAt in interface IFigure

fireMoved

protected void fireMoved()
Notifies any FigureListeners listening to this Figure that it has moved.
Since:
2.0

firePropertyChange

protected void firePropertyChange(String property,
                                  boolean old,
                                  boolean current)
Notifies any PropertyChangeListeners listening to this figure that the boolean property with id property has changed.
Since:
2.0

firePropertyChange

protected void firePropertyChange(String property,
                                  Object old,
                                  Object current)
Notifies any PropertyChangeListeners listening to this figure that the Object property with id property has changed.
Since:
2.0

firePropertyChange

protected void firePropertyChange(String property,
                                  int old,
                                  int current)
Notifies any PropertyChangeListeners listening to this figure that the integer property with id property has changed.
Since:
2.0

getBackgroundColor

public Color getBackgroundColor()
Description copied from interface: IFigure
Returns the background color.
Specified by:
getBackgroundColor in interface IFigure

getBorder

public Border getBorder()
Description copied from interface: IFigure
Returns the current border by reference.
Specified by:
getBorder in interface IFigure

getBounds

public Rectangle getBounds()
Description copied from interface: IFigure
Returns the smallest rectangle completely enclosing the figure. Implementation may return the Rectangle by reference. For this reason, callers of this method must not modify the returned Rectangle.
Specified by:
getBounds in interface IFigure

getChildren

public List getChildren()
Description copied from interface: IFigure
Returns an unmodifiable collection of children by reference.
Specified by:
getChildren in interface IFigure

getClientArea

public Rectangle getClientArea(Rectangle rect)
Modifies the given Rectangle so that it represents this Figure's client area, then returns it.
Since:
2.0

getClientArea

public Rectangle getClientArea()
Description copied from interface: IFigure
Returns the rectangular area within this Figure's bounds in which children will be placed (via LayoutManagers) and the painting of children will be clipped.
Specified by:
getClientArea in interface IFigure

getCursor

public Cursor getCursor()
Description copied from interface: IFigure
Returns the cursor used when the mouse is over this figure.
Specified by:
getCursor in interface IFigure

getFlag

protected boolean getFlag(int flag)

getFont

public Font getFont()
Description copied from interface: IFigure
Returns the current font by reference.
Specified by:
getFont in interface IFigure

getForegroundColor

public Color getForegroundColor()
Description copied from interface: IFigure
Returns the foreground color.
Specified by:
getForegroundColor in interface IFigure

getInsets

public Insets getInsets()
Description copied from interface: IFigure
Returns the current Insets. May be returned by reference.
Specified by:
getInsets in interface IFigure

getLayoutManager

public LayoutManager getLayoutManager()
Description copied from interface: IFigure
Returns the current LayoutManager by reference.
Specified by:
getLayoutManager in interface IFigure

getListeners

protected Iterator getListeners(Class clazz)
Returns an Iterator containing the listeners of type clazz that are listening to this Figure. If there are no listeners of type clazz, an Iterator of an empty list is returned.
Since:
2.0

getLocation

public final Point getLocation()
Returns the top-left corner of this Figure's bounds.
Since:
2.0

getMaximumSize

public Dimension getMaximumSize()
Description copied from interface: IFigure
Returns a hint indicating the largest desireable size for the figure. Returned Dimension is by value.
Specified by:
getMaximumSize in interface IFigure

getMinimumSize

public Dimension getMinimumSize()
Description copied from interface: IFigure
Returns a hint indicating the smallest desireable size for the figure. Returned Dimension is by value.
Specified by:
getMinimumSize in interface IFigure

getParent

public IFigure getParent()
Description copied from interface: IFigure
Returns the current Parent.
Specified by:
getParent in interface IFigure

getPreferredSize

public Dimension getPreferredSize()
Description copied from interface: IFigure
Returns the desireable size for this figure. The returned value should not be modified.
Specified by:
getPreferredSize in interface IFigure

getPreferredSize

public Dimension getPreferredSize(int wHint,
                                  int hHint)
Returns the preferred size this Figure should be, using width and height hints.
Specified by:
getPreferredSize in interface IFigure
Since:
2.0

getSize

public final Dimension getSize()
Returns the current size of this figure.
Specified by:
getSize in interface IFigure
Since:
2.0

getToolTip

public IFigure getToolTip()
Description copied from interface: IFigure
Returns an IFigure that is the tooltip for this Figure.
Specified by:
getToolTip in interface IFigure

getUpdateManager

public UpdateManager getUpdateManager()
Description copied from interface: IFigure
Returns the UpdateManager for this figure by reference.
Specified by:
getUpdateManager in interface IFigure

handleFocusGained

public void handleFocusGained(FocusEvent fe)
Notifies FocusListeners that this figure has gained focus. NOTE: You should not override this method. If you are interested in receiving notification of this type of event, you should register a FocusListener with this figure.
Specified by:
handleFocusGained in interface IFigure
Since:
2.0

handleFocusLost

public void handleFocusLost(FocusEvent fe)
Notifies FocusListeners that this figure has lost focus. NOTE: You should not override this method. If you are interested in receiving notification of this type of event, you should register a FocusListener with this figure.
Specified by:
handleFocusLost in interface IFigure
Since:
2.0

handleKeyPressed

public void handleKeyPressed(KeyEvent e)
Notifies KeyListeners that this figure has lost focus. NOTE: You should not override this method. If you are interested in receiving notification of this type of event, you should register a KeyListener with this figure.
Specified by:
handleKeyPressed in interface IFigure
Since:
2.0

handleKeyReleased

public void handleKeyReleased(KeyEvent e)
Notifies KeyListeners that this figure has lost focus. NOTE: You should not override this method. If you are interested in receiving notification of this type of event, you should register a KeyListener with this figure.
Specified by:
handleKeyReleased in interface IFigure
Since:
2.0

handleMouseDoubleClicked

public void handleMouseDoubleClicked(MouseEvent e)
Notifies MouseListeners that the mouse has been double-clicked on this figure. NOTE: You should not override this method. If you are interested in receiving notification of this type of event, you should register a MouseListener with this figure.
Specified by:
handleMouseDoubleClicked in interface IFigure
Since:
2.0

handleMouseDragged

public void handleMouseDragged(MouseEvent e)
Notifies MouseMotionListeners that the mouse has been dragged over this figure. NOTE: You should not override this method. If you are interested in receiving notification of this type of event, you should register a MouseMotionListener with this figure.
Specified by:
handleMouseDragged in interface IFigure
Since:
2.0

handleMouseEntered

public void handleMouseEntered(MouseEvent e)
Notifies MouseMotionListeners that the mouse has entered this figure. NOTE: You should not override this method. If you are interested in receiving notification of this type of event, you should register a MouseMotionListener with this figure.
Specified by:
handleMouseEntered in interface IFigure
Since:
2.0

handleMouseExited

public void handleMouseExited(MouseEvent e)
Notifies MouseMotionListeners that the mouse has exited this figure. NOTE: You should not override this method. If you are interested in receiving notification of this type of event, you should register a MouseMotionListener with this figure.
Specified by:
handleMouseExited in interface IFigure
Since:
2.0

handleMouseHover

public void handleMouseHover(MouseEvent e)
Notifies MouseMotionListeners that the mouse has hovered over this figure. NOTE: You should not override this method. If you are interested in receiving notification of this type of event, you should register a MouseMotionListener with this figure.
Specified by:
handleMouseHover in interface IFigure
Since:
2.0

handleMouseMoved

public void handleMouseMoved(MouseEvent e)
Notifies MouseMotionListeners that the mouse has moved over this figure. NOTE: You should not override this method. If you are interested in receiving notification of this type of event, you should register a MouseMotionListener with this figure.
Specified by:
handleMouseMoved in interface IFigure
Since:
2.0

handleMousePressed

public void handleMousePressed(MouseEvent e)
Notifies MouseListeners that a mouse button has been pressed while over this figure. NOTE: You should not override this method. If you are interested in receiving notification of this type of event, you should register a MouseListener with this figure.
Specified by:
handleMousePressed in interface IFigure
Since:
2.0

handleMouseReleased

public void handleMouseReleased(MouseEvent e)
Notifies MouseListeners that a mouse button has been released while over this figure. NOTE: You should not override this method. If you are interested in receiving notification of this type of event, you should register a MouseListener with this figure.
Specified by:
handleMouseReleased in interface IFigure
Since:
2.0

hasFocus

public boolean hasFocus()
Description copied from interface: IFigure
Returns true if this figure has focus.
Specified by:
hasFocus in interface IFigure

internalGetEventDispatcher

public EventDispatcher internalGetEventDispatcher()
Description copied from interface: IFigure
This method is for internal purposes only and should not be called.
Specified by:
internalGetEventDispatcher in interface IFigure

intersects

public boolean intersects(Rectangle r)
Description copied from interface: IFigure
Returns true if this figure needs to paint anywhere inside r. Figure is asked so that non-rectangular figures can reduce the frequency of paints.
Specified by:
intersects in interface IFigure

invalidate

public void invalidate()
Description copied from interface: IFigure
Invalidates this figure.
Specified by:
invalidate in interface IFigure

isEnabled

public boolean isEnabled()
Description copied from interface: IFigure
Returns true if this figure is enabled.
Specified by:
isEnabled in interface IFigure

isFocusTraversable

public boolean isFocusTraversable()
Description copied from interface: IFigure
Returns true if this figure can gain focus on a TraverseEvent.
Specified by:
isFocusTraversable in interface IFigure

isMouseEventTarget

protected boolean isMouseEventTarget()
Returns true if this figure can receive MouseEvents.
Since:
2.0

isOpaque

public boolean isOpaque()
Description copied from interface: IFigure
Returns true if this figure is opaque.
Specified by:
isOpaque in interface IFigure

isRequestFocusEnabled

public boolean isRequestFocusEnabled()
Description copied from interface: IFigure
Returns true if this figure can receive focus on a call to requestFocus().
Specified by:
isRequestFocusEnabled in interface IFigure

isValid

protected boolean isValid()
Returns true if this figure is valid.
Since:
2.0

isValidationRoot

protected boolean isValidationRoot()
Returns true if revalidating this figure does not require revalidating its parent.
Since:
2.0

isVisible

public boolean isVisible()
Description copied from interface: IFigure
Returns true if this figure is visible.
Specified by:
isVisible in interface IFigure

layout

protected void layout()
Lays out this figure using its LayoutManager.
Since:
2.0

paint

public void paint(Graphics graphics)
Paints this figure, including its border and children.
Specified by:
paint in interface IFigure
See Also:
paintFigure(Graphics), paintClientArea(Graphics), paintBorder(Graphics)

paintBorder

protected void paintBorder(Graphics graphics)
Paints the border associated with this figure, if one exists.
Since:
2.0
See Also:
Border.paint(IFigure, Graphics, Insets)

paintChildren

protected void paintChildren(Graphics g)
Paint this Figure's children.
Since:
2.0

paintClientArea

protected void paintClientArea(Graphics g)
Paints this Figure's client area. The client ares is typically defined as the anything inside the figures border or insets, and by default includes the children of this figure. This method levaes the graphics context in its initial state.
Since:
2.0

paintFigure

protected void paintFigure(Graphics graphics)
Paints this Figure's primary representation, or background. The client area is painted next. Changes made to the graphics context here affect the other paint methods.
Since:
2.0

primTranslate

protected void primTranslate(int dx,
                             int dy)
Translates this figure's bounds, without firing a move.
Since:
2.0
See Also:
translate(int, int)

remove

public void remove(IFigure figure)
Description copied from interface: IFigure
Removes the given figure from this figure's list of children.
Specified by:
remove in interface IFigure

removeAll

public void removeAll()
Removes all children from this Figure.
Since:
2.0
See Also:
remove(IFigure)

removeAncestorListener

public void removeAncestorListener(AncestorListener listener)
Description copied from interface: IFigure
Unregisters the given listener, so that it will no longer receive notification of ancestor events.
Specified by:
removeAncestorListener in interface IFigure

removeFigureListener

public void removeFigureListener(FigureListener listener)
Description copied from interface: IFigure
Unregisters the given listener, so that it will no longer receive notification of figure events.
Specified by:
removeFigureListener in interface IFigure

removeFocusListener

public void removeFocusListener(FocusListener listener)
Description copied from interface: IFigure
Unregisters the given listener, so that it will no longer receive notification of focus events.
Specified by:
removeFocusListener in interface IFigure

removeListener

protected void removeListener(Class clazz,
                              Object listener)
Removes listener from clazz.
Since:
2.0

removeMouseListener

public void removeMouseListener(MouseListener listener)
Description copied from interface: IFigure
Unregisters the given listener, so that it will no longer receive notification of mouse events.
Specified by:
removeMouseListener in interface IFigure

removeMouseMotionListener

public void removeMouseMotionListener(MouseMotionListener listener)
Description copied from interface: IFigure
Unregisters the given listener, so that it will no longer receive notification of mouse motion events.
Specified by:
removeMouseMotionListener in interface IFigure

removeNotify

public void removeNotify()
Description copied from interface: IFigure
Called before this figure is removed from its parent.
Specified by:
removeNotify in interface IFigure

removePropertyChangeListener

public void removePropertyChangeListener(PropertyChangeListener listener)
Description copied from interface: IFigure
Unregisters the given listener, so that it will no longer receive notification of any property changes.
Specified by:
removePropertyChangeListener in interface IFigure

removePropertyChangeListener

public void removePropertyChangeListener(String property,
                                         PropertyChangeListener listener)
Description copied from interface: IFigure
Unregisters the given listener, so that it will no longer receive notification of changes in the given property.
Specified by:
removePropertyChangeListener in interface IFigure

repaint

public final void repaint(Rectangle r)
Repaints the area of this figure represented by the given Rectangle.
Specified by:
repaint in interface IFigure

repaint

public void repaint(int x,
                    int y,
                    int w,
                    int h)
Description copied from interface: IFigure
Repaints the rectangular area within this figure whose upper-left corner is located at the point (x,y) and whose width and height are w and h, respectively.
Specified by:
repaint in interface IFigure

repaint

public void repaint()
Description copied from interface: IFigure
Repaints this figure.
Specified by:
repaint in interface IFigure

requestFocus

public final void requestFocus()
Description copied from interface: IFigure
Requests focus from the EventDispatcher.
Specified by:
requestFocus in interface IFigure

revalidate

public void revalidate()
Description copied from interface: IFigure
Revalidates this figure.
Specified by:
revalidate in interface IFigure

setBackgroundColor

public void setBackgroundColor(Color bg)
Description copied from interface: IFigure
Sets the background color.
Specified by:
setBackgroundColor in interface IFigure

setBorder

public void setBorder(Border border)
Description copied from interface: IFigure
Sets the border.
Specified by:
setBorder in interface IFigure

setBounds

public void setBounds(Rectangle r)
Sets the bounds of this Figure to the Rectangle r. Note that r is compared to the figure's current bounds to determine what needs to be repainted and/or exposed and if validation is required. Since getBounds() may return the current bounds by reference, it is not safe to modify that Rectangle and then call setBounds() after making modifications. The figure would assume that the bounds are unchanged, and no layout or paint would occur. For proper behavior, always use a copy.
Specified by:
setBounds in interface IFigure
Since:
2.0
See Also:
getBounds()

setChildrenDirection

protected void setChildrenDirection(int dir)
Sets the direction of any Orientable children. Allowable values for dir are found in PositionConstants.
Since:
2.0
See Also:
Orientable.setDirection(int)

setChildrenEnabled

protected void setChildrenEnabled(boolean value)
Sets all childrens' enabled property to value.
Since:
2.0
See Also:
setEnabled(boolean)

setChildrenOrientation

protected void setChildrenOrientation(int orientation)
Sets the orientation of any Orientable children. Allowable values for orientation are found in PositionConstants.
Since:
2.0
See Also:
Orientable.setOrientation(int)

setConstraint

public void setConstraint(IFigure child,
                          Object constraint)
Deprecated. Sets the constraint of a previously added child.

Specified by:
setConstraint in interface IFigure

setCursor

public void setCursor(Cursor cursor)
Description copied from interface: IFigure
Sets the cursor.
Specified by:
setCursor in interface IFigure

setEnabled

public void setEnabled(boolean value)
Description copied from interface: IFigure
Sets this figure to be enabled.
Specified by:
setEnabled in interface IFigure

setFlag

protected final void setFlag(int flag,
                             boolean value)
Sets the given flag to the given value.
Since:
2.0

setFocusTraversable

public void setFocusTraversable(boolean focusTraversable)
Description copied from interface: IFigure
Sets the ability for this figure to gain focus on a TraverseEvent.
Specified by:
setFocusTraversable in interface IFigure

setFont

public void setFont(Font f)
Description copied from interface: IFigure
Sets the font.
Specified by:
setFont in interface IFigure

setForegroundColor

public void setForegroundColor(Color fg)
Description copied from interface: IFigure
Sets the foreground color.
Specified by:
setForegroundColor in interface IFigure

setLayoutManager

public void setLayoutManager(LayoutManager manager)
Description copied from interface: IFigure
Sets the LayoutManager.
Specified by:
setLayoutManager in interface IFigure

setLocation

public void setLocation(Point p)
Description copied from interface: IFigure
Sets the location of this figure.
Specified by:
setLocation in interface IFigure

setMaximumSize

public void setMaximumSize(Dimension d)
Description copied from interface: IFigure
Sets the maximum size this figure can be.
Specified by:
setMaximumSize in interface IFigure

setMinimumSize

public void setMinimumSize(Dimension d)
Description copied from interface: IFigure
Sets the minimum size this figure can be.
Specified by:
setMinimumSize in interface IFigure

setOpaque

public void setOpaque(boolean opaque)
Description copied from interface: IFigure
Sets this figure to be opaque if isOpaque is true and transparent if isOpaque is false.
Specified by:
setOpaque in interface IFigure

setParent

public void setParent(IFigure p)
Description copied from interface: IFigure
Sets this figure's parent.
Specified by:
setParent in interface IFigure

setPreferredSize

public void setPreferredSize(Dimension size)
Description copied from interface: IFigure
Sets this figure's preferred size.
Specified by:
setPreferredSize in interface IFigure

setPreferredSize

public final void setPreferredSize(int w,
                                   int h)
Sets the preferred size of this figure.
Since:
2.0
See Also:
setPreferredSize(Dimension)

setRequestFocusEnabled

public void setRequestFocusEnabled(boolean requestFocusEnabled)
Description copied from interface: IFigure
Sets the ability for this Figure to gain focus on a call to requestFocus().
Specified by:
setRequestFocusEnabled in interface IFigure

setSize

public final void setSize(Dimension d)
Description copied from interface: IFigure
Sets this figure's size.
Specified by:
setSize in interface IFigure

setSize

public void setSize(int w,
                    int h)
Sets the current size of this figure.
Specified by:
setSize in interface IFigure
Since:
2.0

setToolTip

public void setToolTip(IFigure f)
The passed Figure f will appear on a mouse hover over this Figure.
Specified by:
setToolTip in interface IFigure
Since:
2.0

setUpdateManager

public final void setUpdateManager(UpdateManager updateManager)
Description copied from interface: IFigure
Sets the UpdateManager.
Specified by:
setUpdateManager in interface IFigure

setValid

public void setValid(boolean valid)
Sets this figure to be valid if valid is true, and invalid otherwise.
Since:
2.0

setVisible

public void setVisible(boolean visible)
Description copied from interface: IFigure
Sets this figure's visibility.
Specified by:
setVisible in interface IFigure

translate

public final void translate(int x,
                            int y)
Description copied from interface: IFigure
Moves this figure x pixels horizontally and y pixels vertically.
Specified by:
translate in interface IFigure

translateFromParent

public void translateFromParent(Translatable t)
Description copied from interface: IFigure
Translates a Translatable from this figure's parent's coordinates to this figure's local coordinates.
Specified by:
translateFromParent in interface IFigure

translateToAbsolute

public final void translateToAbsolute(Translatable t)
Description copied from interface: IFigure
Translates a Translatable from this figure's coordinates to the top-most parent's coordinates.
Specified by:
translateToAbsolute in interface IFigure

translateToParent

public void translateToParent(Translatable t)
Description copied from interface: IFigure
Translates a Translatable from this figure's coordinates to its parent's coordinates.
Specified by:
translateToParent in interface IFigure

translateToRelative

public final void translateToRelative(Translatable t)
Description copied from interface: IFigure
Translates a Translatable from the top-most parent's coordinates to local coordinates.
Specified by:
translateToRelative in interface IFigure

useLocalCoordinates

protected boolean useLocalCoordinates()
Returns true if this figure uses local coordinates. This means its children are placed relative to this figure's top-left corner.
Since:
2.0

validate

public void validate()
Description copied from interface: IFigure
Causes this figure to layout itself, as well as its children.
Specified by:
validate in interface IFigure

Draw2D v2.0