Package org.eclipse.draw2d

# Class Shape

java.lang.Object
org.eclipse.draw2d.Figure
org.eclipse.draw2d.Shape

All Implemented Interfaces:
  `IFigure`

Direct Known Subclasses:
  `AbstractPointListShape`, `Ellipse`, `RectangleFigure`, `RoundedRectangle`, `Triangle`

public abstract class Shape extends Figure
Provides abstract support for a variety of shapes.

When customizing shapes, you shouldn't override paintFigure(). Override fillShape() and outlineShape() methods instead.

## Nested Class Summary

## Nested classes/interfaces inherited from class org.eclipse.draw2d.Figure

`Figure.FigureIterator, Figure.IdentitySearch, Figure.ReverseFigureChildrenIterator`

## Nested classes/interfaces inherited from interface org.eclipse.draw2d.IFigure

`IFigure.NoInsets`

## Field Summary

Fields
Modifier and Type
Field
Description
`protected int`
`lineStyle`
Deprecated.
Use `setLineStyle(int)` instead.
`protected int`
`lineWidth`
Deprecated.
Use `setLineWidth(int)` or `setLineWidthFloat(float)` instead.

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

`bgColor, border, bounds, fgColor, flags, font, MAX_FLAG, maxSize, minSize, NO_MANAGER, prefSize, toolTip`

### Fields inherited from interface org.eclipse.draw2d.IFigure

`MAX_DIMENSION, MIN_DIMENSION, NO_INSETS`

## Constructor Summary

Constructors
Constructor
Description
`Shape()`
Default constructor.

## Method Summary

Modifier and Type
Method
Description
`protected abstract void`
`fillShape(Graphics graphics)`
Fills the interior of the shape with the background color.
`Integer`
`getAlpha()`
`Integer`
`getAntialias()`
`LineAttributes`
`getLineAttributes()`
Returns line attributes used when drawing this shape.
`int`
`getLineCap()`
Returns the line cap style of this shape's outline.
`float[]`
`getLineDash()`
Returns the line dash style of this shape's outline.
`float`
`getLineDashOffset()`
Returns the line dash offset of this shape's outline.
`int`
`getLineJoin()`
Returns the line join style of this shape's outline.
`float`
`getLineMiterLimit()`
Returns the line dash miter limit of this shape's outline.
`int`
`getLineStyle()`
Returns the line style of this shape's outline.
`int`
`getLineWidth()`
Returns the line width of this shape's outline.
`float`
`getLineWidthFloat()`
Returns the line width of this shape's outline.
`protected abstract void`
`outlineShape(Graphics graphics)`
Outlines this shape using the foreground color.
`void`
`paintFigure(Graphics graphics)`
Paints the shape.
`void`
`setAlpha(int value)`
`void`
`setAlpha(Integer value)`
`void`
`setAntialias(int value)`
`void`
`setAntialias(Integer value)`
`void`
`setFill(boolean b)`
Sets whether this shape should fill its region or not.
`void`
`setFillXOR(boolean b)`
Sets whether XOR based fill should be used by the shape.
`void`
`setLineAttributes(LineAttributes la)`
Sets all line attributes at once.
`void`
`setLineCap(int cap)`
Sets the line cap style of this shape's outline.
`void`
`setLineDash(float[] dash)`
Sets the line dash style of this shape's outline.
`void`
`setLineDashOffset(float dashOffset)`
Sets the line dash offset of this shape's outline.
`void`
`setLineJoin(int join)`
Sets the line join style of this shape's outline.
`void`
`setLineMiterLimit(float miterLimit)`
Sets the line dash miter limit of this shape's outline.
`void`
`setLineStyle(int style)`
Sets the line style of this shape's outline.
`void`
`setLineWidth(int w)`
Sets the line width to be used to outline the shape.
`void`
`setLineWidthFloat(float value)`
Sets the line width of this shape's outline.
`void`
`setOutline(boolean b)`
Sets whether the outline should be drawn for this shape.
`void`
`setOutlineXOR(boolean b)`
Sets whether XOR based outline should be used for this shape.
`void`
`setXOR(boolean b)`
Sets whether XOR based fill and XOR based outline should be used for this shape.

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

`add, add, add, add, addAncestorListener, addCoordinateListener, addFigureListener, addFocusListener, addKeyListener, addLayoutListener, addListener, addMouseListener, addMouseMotionListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, containsPoint, containsPoint, erase, findDescendantAtExcluding, findFigureAt, findFigureAt, findFigureAt, findFigureAtExcluding, findMouseEventTargetAt, findMouseEventTargetInDescendantsAt, fireCoordinateSystemChanged, fireFigureMoved, fireMoved, firePropertyChange, firePropertyChange, firePropertyChange, getBackgroundColor, getBorder, getBounds, getChildren, getChildrenRevIterable, getClientArea, getClientArea, getClippingStrategy, getCursor, getFlag, getFont, getForegroundColor, getInsets, getLayoutManager, getListeners, getListenersIterable, getLocalBackgroundColor, getLocalFont, getLocalForegroundColor, getLocation, getMaximumSize, getMinimumSize, getMinimumSize, getParent, getPreferredSize, getPreferredSize, getSize, getToolTip, getUpdateManager, handleFocusGained, handleFocusLost, handleKeyPressed, handleKeyReleased, handleMouseDoubleClicked, handleMouseDragged, handleMouseEntered, handleMouseExited, handleMouseHover, handleMouseMoved, handleMousePressed, handleMouseReleased, hasFocus, internalGetEventDispatcher, intersects, invalidate, invalidateTree, isCoordinateSystem, isEnabled, isFocusTraversable, isMirrored, isMouseEventTarget, isOpaque, isRequestFocusEnabled, isShowing, isValid, isValidationRoot, isVisible, layout, optimizeClip, paint, paintBorder, paintChildren, paintClientArea, primTranslate, remove, removeAll, removeAncestorListener, removeCoordinateListener, removeFigureListener, removeFocusListener, removeKeyListener, removeLayoutListener, removeListener, removeMouseListener, removeMouseMotionListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, revalidate, setBackgroundColor, setBorder, setBounds, setChildrenDirection, setChildrenEnabled, setChildrenOrientation, setClippingStrategy, setConstraint, setCursor, setEnabled, setFlag, setFocusTraversable, setFont, setForegroundColor, setLayoutManager, setLocation, setMaximumSize, setMinimumSize, setOpaque, setParent, setPreferredSize, setPreferredSize, setRequestFocusEnabled, setSize, setSize, setToolTip, setValid, setVisible, translate, translateFromParent, translateToAbsolute, translateToParent, translateToRelative, useLocalCoordinates, validate`

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

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

## Field Details

### lineWidth

@Deprecated protected int lineWidth
Deprecated.
Use `setLineWidth(int)` or `setLineWidthFloat(float)` instead.
The width of this shape's outline.

### lineStyle

@Deprecated protected int lineStyle
Deprecated.
Use `setLineStyle(int)` instead.
The line style to be used for this shape's outline.

## Constructor Details

### Shape

public Shape()
Default constructor.

Since:
  2.0

## Method Details

### fillShape

protected abstract void fillShape(Graphics graphics)
Fills the interior of the shape with the background color.

Parameters:
  `graphics` - the graphics object

### outlineShape

protected abstract void outlineShape(Graphics graphics)
Outlines this shape using the foreground color.

Parameters:
  `graphics` - the graphics object

### paintFigure

public void paintFigure(Graphics graphics)
Paints the shape. Each shape has an outline to draw, and a region to fill within that outline. Disabled shapes must visually depict the disabled state.

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

### setFill

public void setFill(boolean b)
Sets whether this shape should fill its region or not. It repaints this figure.

Parameters:
  `b` - fill state
Since:
  2.0

### setFillXOR

public void setFillXOR(boolean b)
Sets whether XOR based fill should be used by the shape. It repaints this figure.

Parameters:
  `b` - XOR fill state
Since:
  2.0

### setOutline

public void setOutline(boolean b)
Sets whether the outline should be drawn for this shape.

Parameters:
  `b` - `true` if the shape should be outlined
Since:
  2.0

### setOutlineXOR

public void setOutlineXOR(boolean b)
Sets whether XOR based outline should be used for this shape.

Parameters:
  `b` - `true` if the outline should be XOR'ed
Since:
  2.0

### setXOR

public void setXOR(boolean b)
Sets whether XOR based fill and XOR based outline should be used for this shape.

Parameters:
  `b` - `true` if the outline and fill should be XOR'ed
Since:
  2.0

### getAlpha

public Integer getAlpha()

Since:
  3.5

### getAntialias

public Integer getAntialias()

Since:
  3.5

### getLineAttributes

public LineAttributes getLineAttributes()
Returns line attributes used when drawing this shape.

Returns:
  current line attributes
Since:
  3.5
See Also:
  - `Performance note: creates and returns a clone.`

### getLineWidth

public int getLineWidth()
Returns the line width of this shape's outline.

Returns:
  the line width

### getLineWidthFloat

public float getLineWidthFloat()
Returns the line width of this shape's outline.

Since:
  3.5
See Also:
  - `LineAttributes.width`

### getLineJoin

public int getLineJoin()
Returns the line join style of this shape's outline.

Since:
  3.5
See Also:
  - `LineAttributes.join`

### getLineCap

public int getLineCap()
Returns the line cap style of this shape's outline.

Since:
  3.5
See Also:
  - `LineAttributes.cap`

### getLineStyle

public int getLineStyle()
Returns the line style of this shape's outline.

Returns:
  the line style
See Also:
  - `LineAttributes.style`

### getLineDash

public float[] getLineDash()
Returns the line dash style of this shape's outline.

Since:
  3.5
See Also:
  - `LineAttributes.dash`

### getLineDashOffset

public float getLineDashOffset()
Returns the line dash offset of this shape's outline.

Since:
  3.5
See Also:
  - `LineAttributes.dashOffset`

### getLineMiterLimit

public float getLineMiterLimit()
Returns the line dash miter limit of this shape's outline.

Since:
  3.5
See Also:
  - `LineAttributes.miterLimit`

### setAlpha

public void setAlpha(Integer value)

Since:
  3.5

### setAlpha

public void setAlpha(int value)

Since:
  3.5

### setAntialias

public void setAntialias(Integer value)

Parameters:
  `value` -
Since:
  3.5
See Also:
  - `GC.setAntialias(int)`

### setAntialias

public void setAntialias(int value)

Since:
  3.5

### setLineAttributes

public void setLineAttributes(LineAttributes la)
Sets all line attributes at once.

Parameters:
  `la` -
Since:
  3.5
See Also:
  - `LineAttributes`

### setLineWidth

public void setLineWidth(int w)
Sets the line width to be used to outline the shape.

Parameters:
  `w` - the new width
Since:
  2.0

### setLineWidthFloat

public void setLineWidthFloat(float value)
Sets the line width of this shape's outline.

Parameters:
  `value` -
Since:
  3.5
See Also:
  - `LineAttributes.width`

### setLineJoin

public void setLineJoin(int join)
Sets the line join style of this shape's outline.

Parameters:
  `join` -
Since:
  3.5
See Also:
  - `LineAttributes.join`

### setLineCap

public void setLineCap(int cap)
Sets the line cap style of this shape's outline.

Parameters:
  `cap` -
Since:
  3.5
See Also:
  - `LineAttributes.cap`

### setLineStyle

public void setLineStyle(int style)
Sets the line style of this shape's outline.

Parameters:
  `style` - the new line style
Since:
  2.0
See Also:
  - `LineAttributes.style`

### setLineDash

public void setLineDash(float[] dash)
Sets the line dash style of this shape's outline.

Parameters:
  `dash` -
Since:
  3.5
See Also:
  - `LineAttributes.dash`

### setLineDashOffset

public void setLineDashOffset(float dashOffset)
Sets the line dash offset of this shape's outline.

Parameters:
  `dashOffset` -
Since:
  3.5
See Also:
  - `LineAttributes.dashOffset`

### setLineMiterLimit

public void setLineMiterLimit(float miterLimit)
Sets the line dash miter limit of this shape's outline.

Parameters:
  `miterLimit` -
Since:
  3.5
See Also:
  - `LineAttributes.miterLimit`