Skip to: Site menu | Main content

Groovy 

      Download | Documentation | Developers | Community

An agile dynamic language for the Java Platform

GraphicsBuilder - Shapes Add comment to Wiki View in Wiki Edit Wiki page Printable Version

All shapes support the following additional properties

  • borderColor: defines the color of the shape's outline. If false, the outline will not be drawn.
  • borderWidth: defines the thickness of the shape's outline.
  • fill: defines the color, paint or gradient to fill the shape's content.
  • opacity: controls how much of the shape is visible, value must be in the range [0..1], default is 1.
  • asShape: creates the shape but does not render to the screen, useful for mixing complex shapes.
  • asImage: creates the shape but does not render to the screen, useful for drawing images or applying textures.

Areas

GraphicsBuilder can perform 4 area operations. All area operations require at least 2 shapes, and support additional shapes in the same operation.

Add

Intersect

Subtract

Xor

Shape

Events

All shapes may receive event notifications if the appropriate event handler is declared. The object passed as parameter to each handler is a GraphicsInputEvent, which wraps the original swing event, it has the following properties

source the component where the event occurred, typically a GraphicsPanel
event the wrapped event
sourceShape the shape where the event was triggered
Event Notes
mouseEntered called when the mouse enters the bounds of a shape
mouseExited called when the mouse exits the bounds of a shape
mouseClicked called when the mouse is clicked within the bounds of a shape
mousePresed called when the mouse is pressed within the bounds of a shape
mouseReleased called when the mouse is released within the bounds of a shape
mouseMoved called when the mouse is moved within the bounds of a shape
mouseDragged called when the mouse is dragged within the bounds of a shape
mouseWheelMoved called when the mouse's wheel is moved