Module org.jfree.chart3d
Package org.jfree.chart3d.table

# Class ShapeElement

java.lang.Object
org.jfree.chart3d.table.AbstractTableElement
org.jfree.chart3d.table.ShapeElement

All Implemented Interfaces:
  `Serializable`, `TableElement`

public class ShapeElement extends AbstractTableElement implements TableElement
A table element that displays a shape.
NOTE: This class is serializable, but the serialization format is subject to change in future releases and should not be relied upon for persisting instances of this class.

See Also:
  - Serialized Form

## Field Summary

### Fields inherited from interface org.jfree.chart3d.table.TableElement

`CLASS`

## Constructor Summary

Constructors
Constructor
Description
`ShapeElement(Shape shape, Color fillColor)`
Creates a new shape element.

## Method Summary

Modifier and Type
Method
Description
`void`
`draw(Graphics2D g2, Rectangle2D bounds)`
Draws the shape element within the specified bounds.
`void`
`draw(Graphics2D g2, Rectangle2D bounds, TableElementOnDraw onDrawHandler)`
Draws the element within the specified bounds.
`Color`
`getFillColor()`
Returns the fill color.
`List<Rectangle2D>`
`layoutElements(Graphics2D g2, Rectangle2D bounds, Map<String,Object> constraints)`
Performs a layout of this table element, returning a list of bounding rectangles for the element and its subelements.
`Dimension2D`
`preferredSize(Graphics2D g2, Rectangle2D bounds, Map<String,Object> constraints)`
Returns the preferred size of the element (including insets).
`void`
`receive(TableElementVisitor visitor)`
Receives a visitor.
`void`
`setFillColor(Color color)`
Sets the fill color.
`String`
`toString()`
Returns a string representation of this element, primarily for debugging purposes.

### Methods inherited from class org.jfree.chart3d.table.AbstractTableElement

`equals, getBackground, getInsets, getProperty, getRefPoint, getTag, preferredSize, setBackground, setBackgroundColor, setInsets, setProperty, setRefPoint, setTag`

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

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

### Methods inherited from interface org.jfree.chart3d.table.TableElement

`getProperty, getRefPoint, preferredSize, setProperty`

## Constructor Details

### ShapeElement

public ShapeElement(Shape shape, Color fillColor)
Creates a new shape element.

Parameters:
  `shape` - the shape (`null` not permitted).
  `fillColor` - the fill color (`null` not permitted).

## Method Details

### getFillColor

public Color getFillColor()
Returns the fill color.

Returns:
  The fill color.
Since:
  1.2

### setFillColor

public void setFillColor(Color color)
Sets the fill color.

Parameters:
  `color` - the fill color (`null` not permitted).
Since:
  1.2

### preferredSize

public Dimension2D preferredSize(Graphics2D g2, Rectangle2D bounds, Map<String,Object> constraints)
Description copied from class: `AbstractTableElement`
Returns the preferred size of the element (including insets).

Specified by:
  `preferredSize` in interface `TableElement`
Specified by:
  `preferredSize` in class `AbstractTableElement`
Parameters:
  `g2` - the graphics target.
  `bounds` - the bounds.
  `constraints` - the constraints (ignored for now).
Returns:
  The preferred size.

### layoutElements

public List<Rectangle2D> layoutElements(Graphics2D g2, Rectangle2D bounds, Map<String,Object> constraints)
Description copied from interface: `TableElement`
Performs a layout of this table element, returning a list of bounding rectangles for the element and its subelements. This method is typically called by the `TableElement.draw(java.awt.Graphics2D, java.awt.geom.Rectangle2D)` method.

Specified by:
  `layoutElements` in interface `TableElement`
Parameters:
  `g2` - the graphics target (`null` not permitted).
  `bounds` - the bounds (`null` not permitted).
  `constraints` - the constraints (if any).
Returns:
  A list of bounding rectangles.

### draw

public void draw(Graphics2D g2, Rectangle2D bounds)
Draws the shape element within the specified bounds.

Specified by:
  `draw` in interface `TableElement`
Parameters:
  `g2` - the graphics target (`null` not permitted).
  `bounds` - the bounds (`null` not permitted).

### draw

public void draw(Graphics2D g2, Rectangle2D bounds, TableElementOnDraw onDrawHandler)
Draws the element within the specified bounds. If the `recordBounds` flag is set, this element and each of its children will have their `BOUNDS_2D` property updated with the current bounds.

Specified by:
  `draw` in interface `TableElement`
Parameters:
  `g2` - the graphics target (`null` not permitted).
  `bounds` - the bounds (`null` not permitted).
  `onDrawHandler` - an object that will receive notification before and after the element is drawn (`null` permitted).
Since:
  1.3

### receive

public void receive(TableElementVisitor visitor)
Receives a visitor.

Specified by:
  `receive` in interface `TableElement`
Parameters:
  `visitor` - the visitor (`null` not permitted).
Since:
  1.2

### toString

public String toString()
Returns a string representation of this element, primarily for debugging purposes.

Overrides:
  `toString` in class `Object`
Returns:
  A string representation of this element.