Open Source JavaFX Now!

JFXtras Core Logo

ResizableRectangle

A Drop-in replacement for Rectangle that will resize to fit the bounds of the container. The preferred width and height can be easily set by providing an initial value for the width and height variables, otherwise they will both default to 200.

Unlike a normal Rectangle, the Stroke will always fall within the bounds provided. This ensures that when added to a Container, the size of this ResizableRectangle will not exceed its allocated space regardless of the stroke width.

Try it out

If you would like to try a sample of how this control operates, run the ResizableRectangleTest.fx application in org.jfxtras.scene.shape.

Sample Code

Exactly as for a normal JavaFX Rectangle:

ResizableRectangle { fill: Color.LIGHTBLUE stroke: Color.BLUE strokeWidth: strokeWidth }

General Options

(see JavaFXDoc for details)
<< Back to JFXtras FrontPage < Back to Shapes
0 Attachments 0 Attachments
309 Views