Class Figure

java.lang.Object
org.eclipse.draw2d.Figure
All Implemented Interfaces:
IFigure
Direct Known Subclasses:
AbstractImageFigure, Clickable, Container, FlowFigure, GhostImageFigure, Label, LabeledContainer, Layer, LightweightSystem.RootFigure, Panel, ScrollBar, ScrollPane, Shape, Thumbnail, Viewport

public class Figure extends Object implements IFigure
The base implementation for graphical figures.
  • Field Details

    • MAX_FLAG

      protected static int MAX_FLAG
      The largest flag defined in this class. If subclasses define flags, they should declare them as larger than this value and redefine MAX_FLAG to be their largest flag value.

      This constant is evaluated at runtime and will not be inlined by the compiler.

    • bounds

      protected Rectangle bounds
      The rectangular area that this Figure occupies.
    • flags

      protected int flags
      The flags for this Figure.
    • prefSize

      protected Dimension prefSize
      This Figure's preferred size.
    • minSize

      protected Dimension minSize
      This Figure's minimum size.
    • maxSize

      protected Dimension maxSize
      This Figure's maximum size.
    • font

      @Deprecated protected Font font
      Deprecated.
      access using getLocalFont()
    • bgColor

      @Deprecated protected Color bgColor
      Deprecated.
    • fgColor

      @Deprecated protected Color fgColor
      Deprecated.
    • border

      @Deprecated protected Border border
      Deprecated.
      access using getBorder()
    • toolTip

      @Deprecated protected IFigure toolTip
      Deprecated.
      access using getToolTip()
    • NO_MANAGER

      protected static final UpdateManager NO_MANAGER
      An UpdateManager that does nothing.
  • Constructor Details

    • Figure

      public Figure()
  • Method Details

    • add

      public final void add(IFigure figure, Object constraint)
      Calls add(IFigure, Object, int) with -1 as the index.
      Specified by:
      add in interface IFigure
      Parameters:
      figure - The IFigure to add
      constraint - The newly added IFigure's constraint
      See Also:
    • add

      public void add(IFigure figure, Object constraint, int index)
      Description copied from interface: IFigure
      Adds the child with the specified index and constraint. The child's parent is currently not null, it is removed from that parent. If this figure has a LayoutManager, then LayoutManager.setConstraint(IFigure, Object) shall be called on the layout.
      Specified by:
      add in interface IFigure
      Parameters:
      figure - The IFigure to add
      constraint - The newly added IFigure's constraint
      index - The index where the IFigure should be added
      See Also:
    • add

      public final void add(IFigure figure)
      Calls add(IFigure, Object, int) with null as the constraint and -1 as the index.
      Specified by:
      add in interface IFigure
      Parameters:
      figure - The IFigure to add
      See Also:
    • add

      public final void add(IFigure figure, int index)
      Calls add(IFigure, Object, int) with null as the constraint.
      Specified by:
      add in interface IFigure
      Parameters:
      figure - The IFigure to add
      index - The index where the IFigure should be added
      See Also:
    • addAncestorListener

      public void addAncestorListener(AncestorListener ancestorListener)
      Description copied from interface: IFigure
      Registers the given listener as an AncestorListener of this figure.
      Specified by:
      addAncestorListener in interface IFigure
      Parameters:
      ancestorListener - The listener to add
      See Also:
    • addCoordinateListener

      public void addCoordinateListener(CoordinateListener listener)
      Description copied from interface: IFigure
      Registers the given listener as a CoordinateListener of this figure.
      Specified by:
      addCoordinateListener in interface IFigure
      Parameters:
      listener - the listener to add
      See Also:
    • addFigureListener

      public void addFigureListener(FigureListener listener)
      Description copied from interface: IFigure
      Registers the given listener as a FigureListener of this figure.
      Specified by:
      addFigureListener in interface IFigure
      Parameters:
      listener - The listener to add
      See Also:
    • addFocusListener

      public void addFocusListener(FocusListener listener)
      Description copied from interface: IFigure
      Registers the given listener as a FocusListener of this figure.
      Specified by:
      addFocusListener in interface IFigure
      Parameters:
      listener - The listener to add
      See Also:
    • addKeyListener

      public void addKeyListener(KeyListener listener)
      Description copied from interface: IFigure
      Registers the given listener as a KeyListener of this figure.
      Specified by:
      addKeyListener in interface IFigure
      Parameters:
      listener - The listener to add
      See Also:
    • addLayoutListener

      public void addLayoutListener(LayoutListener listener)
      Appends the given layout listener to the list of layout listeners.
      Specified by:
      addLayoutListener in interface IFigure
      Parameters:
      listener - the listener being added
      Since:
      3.1
    • addListener

      protected <T> void addListener(Class<T> clazz, Object listener)
      Adds a listener of type clazz to this Figure's list of event listeners.
      Parameters:
      clazz - The listener type
      listener - The listener
    • addMouseListener

      public void addMouseListener(MouseListener listener)
      Description copied from interface: IFigure
      Registers the given listener as a MouseListener of this IFigure.
      Specified by:
      addMouseListener in interface IFigure
      Parameters:
      listener - The listener to add
      See Also:
    • addMouseMotionListener

      public void addMouseMotionListener(MouseMotionListener listener)
      Description copied from interface: IFigure
      Registers the given listener as a MouseMotionListener of this IFigure.
      Specified by:
      addMouseMotionListener in interface IFigure
      Parameters:
      listener - The listener to add
      See Also:
    • 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
      Parameters:
      property - The property the listener is interested in
      listener - The listener to add
      See Also:
    • addPropertyChangeListener

      public void addPropertyChangeListener(PropertyChangeListener listener)
      Description copied from interface: IFigure
      Registers the given listener as a PropertyChangeListener of this IFigure.
      Specified by:
      addPropertyChangeListener in interface IFigure
      Parameters:
      listener - The listener to add
      See Also:
    • containsPoint

      public final boolean containsPoint(Point p)
      This method is final. Override containsPoint(int, int) if needed.
      Specified by:
      containsPoint in interface IFigure
      Parameters:
      p - The point
      Returns:
      true if the Point p is contained within this IFigure's bounds
      Since:
      2.0
      See Also:
    • containsPoint

      public boolean containsPoint(int x, int y)
      Description copied from interface: IFigure
      Returns true if the point (x, y) is contained within this IFigure's bounds.
      Specified by:
      containsPoint in interface IFigure
      Parameters:
      x - The X coordinate
      y - The Y coordinate
      Returns:
      true if the point (x,y) is contained in this IFigure's bounds
      See Also:
    • erase

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

      protected IFigure findDescendantAtExcluding(int x, int y, TreeSearch search)
      Returns a descendant of this Figure such that the Figure returned contains the point (x, y), and is accepted by the given TreeSearch. Returns null if none found.
      Parameters:
      x - The X coordinate
      y - The Y coordinate
      search - the TreeSearch
      Returns:
      The descendant Figure at (x,y)
    • findFigureAt

      public final IFigure findFigureAt(Point pt)
      Description copied from interface: IFigure
      Returns the IFigure at the specified location. May return this or null.
      Specified by:
      findFigureAt in interface IFigure
      Parameters:
      pt - The point
      Returns:
      The IFigure at the specified location
      See Also:
    • findFigureAt

      public final IFigure findFigureAt(int x, int y)
      Description copied from interface: IFigure
      Returns the IFigure at the specified location. May return this or null.
      Specified by:
      findFigureAt in interface IFigure
      Parameters:
      x - The X coordinate
      y - The Y coordinate
      Returns:
      The IFigure at the specified location
      See Also:
    • findFigureAt

      public IFigure findFigureAt(int x, int y, TreeSearch search)
      Description copied from interface: IFigure
      Returns the IFigure at the specified location based on the conditional TreeSearch. May return this or null
      Specified by:
      findFigureAt in interface IFigure
      Parameters:
      x - the X coordinate
      y - the Y coordinate
      search - the conditional TreeSearch
      Returns:
      the IFigure at the specified location
      See Also:
    • findFigureAtExcluding

      public final IFigure findFigureAtExcluding(int x, int y, Collection<IFigure> c)
      Description copied from interface: IFigure
      Returns the IFigure at the specified location, excluding any IFigures in collection. May return this or null.
      Specified by:
      findFigureAtExcluding in interface IFigure
      Parameters:
      x - The X coordinate
      y - The Y coordinate
      c - A collection of IFigures to be excluded
      Returns:
      The IFigure at the specified location, excluding any IFigures in collection
      See Also:
    • findMouseEventTargetAt

      public IFigure findMouseEventTargetAt(int x, int y)
      Returns the deepest descendant for which isMouseEventTarget() returns true or null if none found. The Parameters x and y are absolute locations. Any Graphics transformations applied by this Figure to its children during paintChildren(Graphics) (thus causing the children to appear transformed to the user) should be applied inversely to the points x and y when called on the children.
      Specified by:
      findMouseEventTargetAt in interface IFigure
      Parameters:
      x - The X coordinate
      y - The Y coordinate
      Returns:
      The deepest descendant for which isMouseEventTarget() returns true
    • findMouseEventTargetInDescendantsAt

      protected IFigure findMouseEventTargetInDescendantsAt(int x, int y)
      Searches this Figure's children for the deepest descendant for which isMouseEventTarget() returns true and returns that descendant or null if none found.
      Parameters:
      x - The X coordinate
      y - The Y coordinate
      Returns:
      The deepest descendant for which isMouseEventTarget() returns true
      See Also:
    • fireCoordinateSystemChanged

      protected void fireCoordinateSystemChanged()
      Notifies to all CoordinateListeners that this figure's local coordinate system has changed in a way which affects the absolute bounds of figures contained within.
      Since:
      3.1
    • fireFigureMoved

      protected void fireFigureMoved()
      Notifies to all FigureListeners that this figure has moved. Moved means that the bounds have changed in some way, location and/or size.
      Since:
      3.1
    • fireMoved

      @Deprecated protected void fireMoved()
      Deprecated.
      call fireFigureMoved() or fireCoordinateSystemChanged() as appropriate
      Fires both figuremoved and coordinate system changed. This method exists for compatibility. Some listeners which used to listen for figureMoved now listen for coordinates changed. So to be sure that those new listeners are notified, any client code which used called this method will also result in notification of coordinate changes.
      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.
      Parameters:
      property - The id of the property that changed
      old - The old value of the changed property
      current - The current value of the changed property
      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.
      Parameters:
      property - The id of the property that changed
      old - The old value of the changed property
      current - The current value of the changed property
      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.
      Parameters:
      property - The id of the property that changed
      old - The old value of the changed property
      current - The current value of the changed property
      Since:
      2.0
    • getBackgroundColor

      public Color getBackgroundColor()
      Returns this Figure's background color. If this Figure's background color is null and its parent is not null, the background color is inherited from the parent.
      Specified by:
      getBackgroundColor in interface IFigure
      Returns:
      The background color
      See Also:
    • getBorder

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

      public Rectangle getBounds()
      Returns the smallest rectangle completely enclosing the figure. Implementors 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
      Returns:
      The bounds of this Figure
    • getChildren

      public List<? extends IFigure> getChildren()
      Description copied from interface: IFigure
      Returns an unmodifiable list of children by reference.
      Specified by:
      getChildren in interface IFigure
      Returns:
      An unmodifiable list of children by reference
      See Also:
    • getChildrenRevIterable

      public Iterable<IFigure> getChildrenRevIterable()
      Provide an iterable that will iterate in reverse over all children of this figure.
      Since:
      3.13
    • getClientArea

      public Rectangle getClientArea(Rectangle rect)
      Description copied from interface: IFigure
      Copies the client area into the specificied Recangle, and returns that rectangle for convenience.
      Specified by:
      getClientArea in interface IFigure
      Parameters:
      rect - The destination rectangle for the client area
      Returns:
      The same instance that was passed in, modified to contain the client area
      See Also:
    • getClientArea

      public final 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
      Returns:
      The client area
      See Also:
    • getClippingStrategy

      public IClippingStrategy getClippingStrategy()
      Returns the IClippingStrategy used by this figure to clip its children
      Specified by:
      getClippingStrategy in interface IFigure
      Returns:
      the IClipppingStrategy used to clip this figure's children.
      Since:
      3.6
    • getCursor

      public Cursor getCursor()
      Description copied from interface: IFigure
      Returns the Cursor used when the mouse is over this IFigure.
      Specified by:
      getCursor in interface IFigure
      Returns:
      The Cursor used when the mouse is over this IFigure
      See Also:
    • getFlag

      protected boolean getFlag(int flag)
      Returns the value of the given flag.
      Parameters:
      flag - The flag to get
      Returns:
      The value of the given flag
    • getFont

      public Font getFont()
      Description copied from interface: IFigure
      Returns the current Font by reference.
      Specified by:
      getFont in interface IFigure
      Returns:
      The current Font
      See Also:
    • getForegroundColor

      public Color getForegroundColor()
      Description copied from interface: IFigure
      Returns the foreground color.
      Specified by:
      getForegroundColor in interface IFigure
      Returns:
      The foreground color
      See Also:
    • getInsets

      public Insets getInsets()
      Returns the border's Insets if the border is set. Otherwise returns NO_INSETS, an instance of Insets with all 0s. Returns Insets by reference. DO NOT Modify returned value. Cannot return null.
      Specified by:
      getInsets in interface IFigure
      Returns:
      This Figure's Insets
    • getLayoutManager

      public LayoutManager getLayoutManager()
      Description copied from interface: IFigure
      Returns the current LayoutManager by reference.
      Specified by:
      getLayoutManager in interface IFigure
      Returns:
      The current LayoutManager by reference
      See Also:
    • getListeners

      protected <T> Iterator<T> getListeners(Class<T> clazz)
      Returns an Iterator over the listeners of type clazz that are listening to this Figure. If there are no listeners of type clazz, an empty iterator is returned.
      Parameters:
      clazz - The type of listeners to get
      Returns:
      An Iterator over the requested listeners
      Since:
      2.0
    • getListenersIterable

      protected <T> Iterable<T> getListenersIterable(Class<T> listenerType)
      * Returns an Iterator over the listeners of type listenerType that are listening to this Figure. If there are no listeners of type listenerType, an empty iterator is returned.
      Parameters:
      listenerType - The type of listeners to get
      Returns:
      an Iterable over the requested listeners c
      Since:
      3.13
    • getLocalBackgroundColor

      public Color getLocalBackgroundColor()
      Returns null or the local background Color of this Figure. Does not inherit this Color from the parent.
      Specified by:
      getLocalBackgroundColor in interface IFigure
      Returns:
      bgColor null or the local background Color
    • getLocalFont

      protected Font getLocalFont()
      Returns null or the local font setting for this figure. Does not return values inherited from the parent figure.
      Returns:
      null or the local font
      Since:
      3.1
    • getLocalForegroundColor

      public Color getLocalForegroundColor()
      Returns null or the local foreground Color of this Figure. Does not inherit this Color from the parent.
      Specified by:
      getLocalForegroundColor in interface IFigure
      Returns:
      fgColor null or the local foreground Color
    • getLocation

      public final Point getLocation()
      Returns the top-left corner of this Figure's bounds.
      Specified by:
      getLocation in interface IFigure
      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 IFigure. Returned Dimension is by value.
      Specified by:
      getMaximumSize in interface IFigure
      Returns:
      The maximum size
      See Also:
    • getMinimumSize

      public final Dimension getMinimumSize()
      Description copied from interface: IFigure
      Returns a hint indicating the smallest desireable size for the IFigure. The returned dimension may be by reference, and it must not be modified by the caller.
      Specified by:
      getMinimumSize in interface IFigure
      Returns:
      The minimum size
      See Also:
    • getMinimumSize

      public Dimension getMinimumSize(int wHint, int hHint)
      Description copied from interface: IFigure
      Returns a hint indicating the smallest desireable size for the IFigure. The returned dimension may be by reference, and it must not be modified by the caller.
      Specified by:
      getMinimumSize in interface IFigure
      Parameters:
      wHint - the width hint
      hHint - the height hint
      Returns:
      The minimum size
      See Also:
    • getParent

      public IFigure getParent()
      Description copied from interface: IFigure
      Returns the IFigure that is the current parent of this IFigure or null if there is no parent.
      Specified by:
      getParent in interface IFigure
      Returns:
      null or the parent figure
      See Also:
    • getPreferredSize

      public final Dimension getPreferredSize()
      Description copied from interface: IFigure
      Returns the preferred size for this IFigure. The returned value must not be modified by the caller. If the figure has no preference, it returns its current size. The same as calling getPreferredSize(-1, -1).
      Specified by:
      getPreferredSize in interface IFigure
      Returns:
      The preferred size
      See Also:
    • getPreferredSize

      public Dimension getPreferredSize(int wHint, int hHint)
      Description copied from interface: IFigure
      Returns the preferred size for this IFigure using the provided width and height hints. The returned dimension may be by reference, and it must not be modified by the caller. A value of -1 indicates that there is no constraint in that direction.
      Specified by:
      getPreferredSize in interface IFigure
      Parameters:
      wHint - a width hint
      hHint - a height hint
      Returns:
      The preferred size
      See Also:
    • getSize

      public final Dimension getSize()
      Description copied from interface: IFigure
      Returns the current size. Returned Dimension is by value.
      Specified by:
      getSize in interface IFigure
      Returns:
      The current size
      See Also:
    • getToolTip

      public IFigure getToolTip()
      Description copied from interface: IFigure
      Returns a IFigure that is the tooltip for this IFigure.
      Specified by:
      getToolTip in interface IFigure
      Returns:
      This IFigure's tooltip
      See Also:
    • getUpdateManager

      public UpdateManager getUpdateManager()
      Description copied from interface: IFigure
      Returns the UpdateManager for this IFigure by reference.
      Specified by:
      getUpdateManager in interface IFigure
      Returns:
      The update manager
      See Also:
    • handleFocusGained

      public void handleFocusGained(FocusEvent event)
      Description copied from interface: IFigure
      Called when this IFigure 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 IFigure.

      Specified by:
      handleFocusGained in interface IFigure
      Parameters:
      event - The focus event
      See Also:
    • handleFocusLost

      public void handleFocusLost(FocusEvent event)
      Description copied from interface: IFigure
      Called when this IFigure 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 IFigure.

      Specified by:
      handleFocusLost in interface IFigure
      Parameters:
      event - The focus event
      See Also:
    • handleKeyPressed

      public void handleKeyPressed(KeyEvent event)
      Description copied from interface: IFigure
      Called when a key is pressed while this IFigure has 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 IFigure.

      Specified by:
      handleKeyPressed in interface IFigure
      Parameters:
      event - The key event
      See Also:
    • handleKeyReleased

      public void handleKeyReleased(KeyEvent event)
      Description copied from interface: IFigure
      Called when a key is released while this IFigure has 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 IFigure.

      Specified by:
      handleKeyReleased in interface IFigure
      Parameters:
      event - The key event
      See Also:
    • handleMouseDoubleClicked

      public void handleMouseDoubleClicked(MouseEvent event)
      Description copied from interface: IFigure
      Called when a mouse button has been double-clicked while within this IFigure's bounds.

      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 IFigure.

      Specified by:
      handleMouseDoubleClicked in interface IFigure
      Parameters:
      event - The mouse event
      See Also:
    • handleMouseDragged

      public void handleMouseDragged(MouseEvent event)
      Description copied from interface: IFigure
      Called when the mouse has been dragged within this IFigure's bounds.

      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 IFigure.

      Specified by:
      handleMouseDragged in interface IFigure
      Parameters:
      event - The mouse event
      See Also:
    • handleMouseEntered

      public void handleMouseEntered(MouseEvent event)
      Description copied from interface: IFigure
      Called when the mouse has entered this IFigure's bounds.

      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 IFigure.

      Specified by:
      handleMouseEntered in interface IFigure
      Parameters:
      event - The mouse event
      See Also:
    • handleMouseExited

      public void handleMouseExited(MouseEvent event)
      Description copied from interface: IFigure
      Called when the mouse has exited this IFigure's bounds.

      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 IFigure.

      Specified by:
      handleMouseExited in interface IFigure
      Parameters:
      event - The mouse event
      See Also:
    • handleMouseHover

      public void handleMouseHover(MouseEvent event)
      Description copied from interface: IFigure
      Called when the mouse has hovered over this IFigure.

      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 IFigure.

      Specified by:
      handleMouseHover in interface IFigure
      Parameters:
      event - The mouse event
      See Also:
    • handleMouseMoved

      public void handleMouseMoved(MouseEvent event)
      Description copied from interface: IFigure
      Called when the mouse has moved within this IFigure's bounds.

      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 IFigure.

      Specified by:
      handleMouseMoved in interface IFigure
      Parameters:
      event - The mouse event
      See Also:
    • handleMousePressed

      public void handleMousePressed(MouseEvent event)
      Description copied from interface: IFigure
      Called when a mouse button has been pressed while within this IFigure's bounds.

      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 IFigure.

      Specified by:
      handleMousePressed in interface IFigure
      Parameters:
      event - The mouse event
      See Also:
    • handleMouseReleased

      public void handleMouseReleased(MouseEvent event)
      Description copied from interface: IFigure
      Called when a mouse button has been released while within this IFigure's bounds.

      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 IFigure.

      Specified by:
      handleMouseReleased in interface IFigure
      Parameters:
      event - The mouse event
      See Also:
    • hasFocus

      public boolean hasFocus()
      Description copied from interface: IFigure
      Returns true if this IFigure has focus.
      Specified by:
      hasFocus in interface IFigure
      Returns:
      true if this IFigure has focus
      See Also:
    • 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
      Returns:
      The event dispatcher
      See Also:
    • intersects

      public boolean intersects(Rectangle rect)
      Description copied from interface: IFigure
      Returns true if this IFigure's bounds intersect with the given Rectangle. Figure is asked so that non-rectangular IFigures can reduce the frequency of paints.
      Specified by:
      intersects in interface IFigure
      Parameters:
      rect - The rectangle to check for intersection
      Returns:
      true if this IFigure's bounds intersect with the given Rectangle
      See Also:
    • invalidate

      public void invalidate()
      Description copied from interface: IFigure
      Invalidates this IFigure. If this figure has a LayoutManager, then LayoutManager.invalidate() should be called on that layout.
      Specified by:
      invalidate in interface IFigure
      See Also:
    • invalidateTree

      public void invalidateTree()
      Description copied from interface: IFigure
      Invalidates this figure as well as all contained within.
      Specified by:
      invalidateTree in interface IFigure
      See Also:
    • isCoordinateSystem

      public boolean isCoordinateSystem()
      Description copied from interface: IFigure
      Returns true if this figure is capable of applying a local coordinate system which affects its children.
      Specified by:
      isCoordinateSystem in interface IFigure
      Returns:
      true if this figure provides local coordinates to children
      See Also:
    • isEnabled

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

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

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

      public boolean isMirrored()
      Specified by:
      isMirrored in interface IFigure
      Returns:
      true if this figure is hosted in a Control that is mirrored
      See Also:
    • isOpaque

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

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

      public boolean isShowing()
      Description copied from interface: IFigure
      Returns true if this IFigure is showing. This figure is only showing if it is visible and its parent is showing, or it has no parent.
      Specified by:
      isShowing in interface IFigure
      Returns:
      true if this IFigure is showing
      See Also:
    • isValid

      protected boolean isValid()
      Returns true if this Figure is valid.
      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.
      Returns:
      true if revalidating this Figure doesn't require revalidating its parent.
      Since:
      2.0
    • isVisible

      public boolean isVisible()
      Description copied from interface: IFigure
      returns true if this figure's visibility flag is set to true. Does not walk up the parent chain.
      Specified by:
      isVisible in interface IFigure
      Returns:
      true if the figure's visibility flag is set
      See Also:
    • layout

      protected void layout()
      Lays out this Figure using its LayoutManager.
      Since:
      2.0
    • paint

      public void paint(Graphics graphics)
      Paints this Figure and its children.
      Specified by:
      paint in interface IFigure
      Parameters:
      graphics - The Graphics object used for painting
      See Also:
    • paintBorder

      protected void paintBorder(Graphics graphics)
      Paints the border associated with this Figure, if one exists.
      Parameters:
      graphics - The Graphics used to paint
      Since:
      2.0
      See Also:
    • paintChildren

      protected void paintChildren(Graphics graphics)
      Paints this Figure's children. The caller must save the state of the graphics prior to calling this method, such that graphics.restoreState() may be called safely, and doing so will return the graphics to its original state when the method was entered.

      This method must leave the Graphics in its original state upon return.

      Parameters:
      graphics - the graphics used to paint
      Since:
      2.0
    • paintClientArea

      protected void paintClientArea(Graphics graphics)
      Paints this Figure's client area. The client area is typically defined as the anything inside the Figure's Border or Insets, and by default includes the children of this Figure. On return, this method must leave the given Graphics in its initial state.
      Parameters:
      graphics - The Graphics used to paint
      Since:
      2.0
    • optimizeClip

      protected boolean optimizeClip()
      Since:
      3.13
    • paintFigure

      protected void paintFigure(Graphics graphics)
      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 paintClientArea(Graphics) and 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.
      Parameters:
      graphics - The Graphics used to paint
      Since:
      2.0
    • primTranslate

      protected void primTranslate(int dx, int dy)
      Translates this Figure's bounds, without firing a move.
      Parameters:
      dx - The amount to translate horizontally
      dy - The amount to translate vertically
      Since:
      2.0
      See Also:
    • remove

      public void remove(IFigure figure)
      Removes the given child Figure from this Figure's hierarchy and revalidates this Figure. The child Figure's removeNotify() method is also called.
      Specified by:
      remove in interface IFigure
      Parameters:
      figure - The Figure to remove
    • removeAll

      public void removeAll()
      Removes all children from this Figure.
      Since:
      2.0
      See Also:
    • 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
      Parameters:
      listener - The listener to remove
      See Also:
    • removeCoordinateListener

      public void removeCoordinateListener(CoordinateListener listener)
      Description copied from interface: IFigure
      Unregisters the given listener, so that it will no longer receive notification of coordinate changes.
      Specified by:
      removeCoordinateListener in interface IFigure
      Parameters:
      listener - the listener to remove
      See Also:
    • removeFigureListener

      public void removeFigureListener(FigureListener listener)
      Description copied from interface: IFigure
      Unregisters the given listener, so that it will no longer receive notification of IFigure events.
      Specified by:
      removeFigureListener in interface IFigure
      Parameters:
      listener - The listener to remove
      See Also:
    • 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
      Parameters:
      listener - The listener to remove
      See Also:
    • removeKeyListener

      public void removeKeyListener(KeyListener listener)
      Description copied from interface: IFigure
      Removes the first occurence of the given listener.
      Specified by:
      removeKeyListener in interface IFigure
      Parameters:
      listener - The listener to remove
      See Also:
    • removeLayoutListener

      public void removeLayoutListener(LayoutListener listener)
      Removes the first occurence of the given listener.
      Specified by:
      removeLayoutListener in interface IFigure
      Parameters:
      listener - the listener being removed
      Since:
      3.1
    • removeListener

      protected <T> void removeListener(Class<T> clazz, Object listener)
      Removes listener of type clazz from this Figure's list of listeners.
      Parameters:
      clazz - The type of listener
      listener - The listener to remove
      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
      Parameters:
      listener - The listener to remove
      See Also:
    • 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
      Parameters:
      listener - The listener to remove
      See Also:
    • removeNotify

      public void removeNotify()
      Called prior to this figure's removal 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
      Parameters:
      listener - The listener to remove
      See Also:
    • 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. This will only unregister the listener for the given property. If the listener is registered to listen to other properties, this will not affect the notification of the listener regarding those properties.
      Specified by:
      removePropertyChangeListener in interface IFigure
      Parameters:
      property - The property that the listener is no longer interested in
      listener - The listener no longer interested in the property
      See Also:
    • repaint

      public final void repaint(Rectangle rect)
      Description copied from interface: IFigure
      Repaints the rectangular area within this IFigure represented by rect.
      Specified by:
      repaint in interface IFigure
      Parameters:
      rect - The rectangular area to be repainted
      See Also:
    • repaint

      public void repaint(int x, int y, int w, int h)
      Description copied from interface: IFigure
      Repaints the rectangular area within this IFigure 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
      Parameters:
      x - The X coordinate of the area to repaint
      y - The Y coordinate of the area to repaint
      w - The width of the area to repaint
      h - The height of the area to repaint
      See Also:
    • repaint

      public void repaint()
      Description copied from interface: IFigure
      Repaints this IFigure.
      Specified by:
      repaint in interface IFigure
      See Also:
    • requestFocus

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

      public void revalidate()
      Description copied from interface: IFigure
      Invalidates this figure and revalidates() its parent. If a figure does not have a parent, it will request a validation from it UpdateManager. Calling this method does not guarantee that a repaint will occur.
      Specified by:
      revalidate in interface IFigure
      See Also:
    • setBackgroundColor

      public void setBackgroundColor(Color bg)
      Description copied from interface: IFigure
      Sets the background color.
      Specified by:
      setBackgroundColor in interface IFigure
      Parameters:
      bg - The new background color
      See Also:
    • setBorder

      public void setBorder(Border border)
      Description copied from interface: IFigure
      Sets the border.
      Specified by:
      setBorder in interface IFigure
      Parameters:
      border - The new border
      See Also:
    • setBounds

      public void setBounds(Rectangle rect)
      Sets the bounds of this Figure to the Rectangle rect. Note that rect 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
      Parameters:
      rect - The new bounds
      Since:
      2.0
    • setChildrenDirection

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

      protected void setChildrenEnabled(boolean value)
      Sets all childrens' enabled property to value.
      Parameters:
      value - The enable value
      Since:
      2.0
      See Also:
    • setChildrenOrientation

      protected void setChildrenOrientation(int orientation)
      Sets the orientation of any Orientable children. Allowable values for orientation are found in PositionConstants.
      Parameters:
      orientation - The Orientation
      Since:
      2.0
      See Also:
    • setConstraint

      public void setConstraint(IFigure child, Object constraint)
      Description copied from interface: IFigure
      Convenience method to set the constraint of the specified child in the current LayoutManager.
      Specified by:
      setConstraint in interface IFigure
      Parameters:
      child - The figure whose constraint is being set
      constraint - the constraint
      See Also:
    • setClippingStrategy

      public void setClippingStrategy(IClippingStrategy clippingStrategy)
      Registers a clipping strategy to specify how clipping is performed for child figures.
      Specified by:
      setClippingStrategy in interface IFigure
      Parameters:
      clippingStrategy -
      Since:
      3.6
    • setCursor

      public void setCursor(Cursor cursor)
      Description copied from interface: IFigure
      Sets the cursor.
      Specified by:
      setCursor in interface IFigure
      Parameters:
      cursor - The new cursor
      See Also:
    • setEnabled

      public void setEnabled(boolean value)
      Description copied from interface: IFigure
      Sets this IFigure to be enabled.
      Specified by:
      setEnabled in interface IFigure
      Parameters:
      value - true if this IFigure should be enabled
      See Also:
    • setFlag

      protected final void setFlag(int flag, boolean value)
      Sets the given flag to the given value.
      Parameters:
      flag - The flag to set
      value - The value
      Since:
      2.0
    • setFocusTraversable

      public void setFocusTraversable(boolean focusTraversable)
      Description copied from interface: IFigure
      Sets the ability for this IFigure to gain focus on a TraverseEvent.
      Specified by:
      setFocusTraversable in interface IFigure
      Parameters:
      focusTraversable - true if this IFigure should gain focus on a TraverseEvent
      See Also:
    • setFont

      public void setFont(Font f)
      Description copied from interface: IFigure
      Sets the font.
      Specified by:
      setFont in interface IFigure
      Parameters:
      f - The new font
      See Also:
    • setForegroundColor

      public void setForegroundColor(Color fg)
      Description copied from interface: IFigure
      Sets the foreground color.
      Specified by:
      setForegroundColor in interface IFigure
      Parameters:
      fg - The new foreground color
      See Also:
    • setLayoutManager

      public void setLayoutManager(LayoutManager manager)
      Description copied from interface: IFigure
      Sets the LayoutManager.
      Specified by:
      setLayoutManager in interface IFigure
      Parameters:
      manager - The new layout manager
      See Also:
    • setLocation

      public void setLocation(Point p)
      Description copied from interface: IFigure
      Sets the location of this IFigure.
      Specified by:
      setLocation in interface IFigure
      Parameters:
      p - The new location
      See Also:
    • setMaximumSize

      public void setMaximumSize(Dimension d)
      Description copied from interface: IFigure
      Sets the maximum size this IFigure can be.
      Specified by:
      setMaximumSize in interface IFigure
      Parameters:
      d - The new maximum size
      See Also:
    • setMinimumSize

      public void setMinimumSize(Dimension d)
      Description copied from interface: IFigure
      Sets the minimum size this IFigure can be.
      Specified by:
      setMinimumSize in interface IFigure
      Parameters:
      d - The new minimum size
      See Also:
    • setOpaque

      public void setOpaque(boolean opaque)
      Description copied from interface: IFigure
      Sets this IFigure to be opaque if isOpaque is true and transparent if isOpaque is false.
      Specified by:
      setOpaque in interface IFigure
      Parameters:
      opaque - true is this IFigure should be opaque
      See Also:
    • setParent

      public void setParent(IFigure p)
      Description copied from interface: IFigure
      Sets this IFigure's parent.
      Specified by:
      setParent in interface IFigure
      Parameters:
      p - The new parent IFigure
      See Also:
    • setPreferredSize

      public void setPreferredSize(Dimension size)
      Description copied from interface: IFigure
      Sets this IFigure's preferred size.
      Specified by:
      setPreferredSize in interface IFigure
      Parameters:
      size - The new preferred size
      See Also:
    • setPreferredSize

      public final void setPreferredSize(int w, int h)
      Sets the preferred size of this figure.
      Parameters:
      w - The new preferred width
      h - The new preferred height
      Since:
      2.0
      See Also:
    • setRequestFocusEnabled

      public void setRequestFocusEnabled(boolean requestFocusEnabled)
      Description copied from interface: IFigure
      Sets the ability for this Figure to gain focus on a call to IFigure.requestFocus().
      Specified by:
      setRequestFocusEnabled in interface IFigure
      Parameters:
      requestFocusEnabled - true if this IFigure should gain focus on a call to requestFocus()
      See Also:
    • setSize

      public final void setSize(Dimension d)
      Description copied from interface: IFigure
      Sets this IFigure's size.
      Specified by:
      setSize in interface IFigure
      Parameters:
      d - The new size
      See Also:
    • setSize

      public void setSize(int w, int h)
      Description copied from interface: IFigure
      Sets this IFigure's size.
      Specified by:
      setSize in interface IFigure
      Parameters:
      w - The new width
      h - The new height
      See Also:
    • setToolTip

      public void setToolTip(IFigure f)
      Description copied from interface: IFigure
      Sets a tooltip that is displayed when the mouse hovers over this IFigure.
      Specified by:
      setToolTip in interface IFigure
      Parameters:
      f - The tooltip IFigure
      See Also:
    • setValid

      public void setValid(boolean value)
      Sets this figure to be valid if value is true and invalid otherwise.
      Parameters:
      value - The valid value
      Since:
      2.0
    • setVisible

      public void setVisible(boolean visible)
      Description copied from interface: IFigure
      Sets this IFigure's visibility.
      Specified by:
      setVisible in interface IFigure
      Parameters:
      visible - true if this IFigure should be visible
      See Also:
    • translate

      public final void translate(int x, int y)
      Description copied from interface: IFigure
      Moves this IFigure x pixels horizontally and y pixels vertically.
      Specified by:
      translate in interface IFigure
      Parameters:
      x - The amount to move this IFigure horizontally
      y - The amount to move this IFigure vertically
      See Also:
    • translateFromParent

      public void translateFromParent(Translatable t)
      Description copied from interface: IFigure
      Translates a Translatable from this IFigure's parent's coordinates to this IFigure's local coordinates.
      Specified by:
      translateFromParent in interface IFigure
      Parameters:
      t - The object to translate
      See Also:
    • translateToAbsolute

      public final void translateToAbsolute(Translatable t)
      Description copied from interface: IFigure
      Translates a Translatable that is relative to this figure's bounds to absolute.
      Specified by:
      translateToAbsolute in interface IFigure
      Parameters:
      t - The object to translate
      See Also:
    • translateToParent

      public void translateToParent(Translatable t)
      Description copied from interface: IFigure
      Translates a Translatable from this IFigure's coordinates to its parent's coordinates.
      Specified by:
      translateToParent in interface IFigure
      Parameters:
      t - The object to translate
      See Also:
    • translateToRelative

      public final void translateToRelative(Translatable t)
      Description copied from interface: IFigure
      Translates a Translatable in absolute coordinates to be relative to this figure's bounds.
      Specified by:
      translateToRelative in interface IFigure
      Parameters:
      t - The object to translate
      See Also:
    • 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.
      Returns:
      true if this Figure uses local coordinates
      Since:
      2.0
    • validate

      public void validate()
      Description copied from interface: IFigure
      Indicates that this figure should make itself valid. Validation includes invoking layout on a LayoutManager if present, and then validating all children figures. Default validation uses pre-order, depth-first ordering.
      Specified by:
      validate in interface IFigure
      See Also: