org.eclipse.draw2d

## Class AbstractBackground

- java.lang.Object
- - org.eclipse.draw2d.AbstractBorder
  - - org.eclipse.draw2d.AbstractBackground

All Implemented Interfaces:
  Border

    public class AbstractBackground
    extends AbstractBorder

A special border which can paint both underneath and on top of a Figure. Normal borders only paint on top of a figure and its children. A background has the opportunity to paint both first, and optionally last.

WARNING: Experimental for 3.3. Clients should help validate the use cases of this new function.

Since:
  3.3

### Field Summary

### Fields inherited from class org.eclipse.draw2d.AbstractBorder

`tempRect`

### Constructor Summary

Constructors
Constructor and Description
`AbstractBackground()`

### Method Summary

Methods
`Insets` `getInsets(IFigure figure)` Returns the Insets for this Border for the given Figure.
`void` `paint(IFigure figure, Graphics graphics, Insets insets)` Paints the border.
`void` `paintBackground(IFigure figure, Graphics graphics, Insets insets)` Called when this Background should paint.

### Methods inherited from class org.eclipse.draw2d.AbstractBorder

`getPaintRectangle, getPreferredSize, isOpaque`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### AbstractBackground

    public AbstractBackground()

### Method Detail

#### getInsets

    public Insets getInsets(IFigure figure)

Returns the Insets for this Border for the given Figure.

Parameters:
  `figure` - The figure this border belongs to
Returns:
  The insets

#### paint

    public void paint(IFigure figure,
             Graphics graphics,
             Insets insets)

Paints the border. The border should paint inside figure's `IFigure.getBounds()`, inset by the parameter insets. The border generally should not paint inside its own insets. More specifically, Border b should paint inside the rectangle: figure.getBounds().getCropped(insets) and outside of the rectangle: figure.getBounds().getCropped(insets).getCropped(getInsets()) where inside is defined as `Rectangle.contains(int, int)`. By default, this method is stubbed out for backgrounds which only paint underneath a figure.

Parameters:
  `figure` - The figure this border belongs to
  `graphics` - The graphics object used for painting
  `insets` - The insets

#### paintBackground

    public void paintBackground(IFigure figure,
                       Graphics graphics,
                       Insets insets)

Called when this Background should paint. If the background is being painted inside another border or background, the insets indicate how far inside the target figure the background should be painted. In most cases, the insets will be all zero.

Parameters:
  `figure` - The figure on which the background is being painted
  `graphics` - The graphics
  `insets` - Amount to inset from the figure's bounds
Since:
  3.2