The open source JFXtras project provides extra capabilities for JavaFX, such as a powerful Grid layout facility, dialog box capability, easy to use asynchronous thread support and declarative unit testing. The JFXtras 0.2 release features a new custom shape library that came out of a joint effort with the jSilhouette Project. See Stephen Chin's blog post for more information on this release. Also, see Andres Almiray's blog post on the jSilhouette 0.3 release.
Here a screenshot of the ShapesDemoFX program that is included with the JFXtras project. Click the Java Web Start link below to run the demo.
Here's a screenshot from a little program written by Chris Wright that demonstrates how to use some of the shapes in JFXtras, followed by the source code:
import javafx.scene.*;
import javafx.stage.*;
import javafx.scene.text.*;
import javafx.scene.paint.*;
import javafx.scene.layout.*;
import javafx.scene.transform.*;
import org.jfxtras.scene.shape.*;
Stage {
width: 500
height: 350
title: "JFXtras 0.2"
scene:
Scene {
fill: Color.BLACK
content: [
Group {
content: [
MultiRoundRectangle {
x: 50
y: 100
width: 400
height: 100
topRightWidth: 35
topRightHeight: 35
bottomRightWidth: 35
bottomRightHeight: 35
fill: LinearGradient {
startX: 0.0
startY: 0.0
endX: 1.0
endY: 0.0
proportional: true
stops: [
Stop {
offset: 0.0
color: Color.rgb(255,255,51)
},
Stop {
offset: 0.5
color: rgb(255,102,0)
}
]
}
},
ReuleauxTriangle {
angle: -48
x: 150
y: 100
width: 175
fill: Color.rgb(204,0,0)
stroke: Color.rgb(102,0,0)
},
HBox {
transforms: Translate.translate(90, 110)
content: [
Text {
content: "JFX"
textOrigin: TextOrigin.TOP
font: Font.font("Sans serif", FontWeight.BOLD, 100)
},
Text {
transforms: Translate.translate(0, 10)
content: "tras"
textOrigin: TextOrigin.TOP
font: Font.font("Sans serif", FontWeight.BOLD, FontPosture.ITALIC, 70)
}
]
}
]
}
HBox {
transforms: Translate.translate(90, 250)
spacing: 7
content: [
Asterisk {
centerX: 10
centerY: 10
radius: 25
width: 4
beams: 7
roundness: 0.5
fill: Color.WHITE
},
Text {
content: "Now With Cool Shapes!"
textOrigin: TextOrigin.TOP
font: Font.font("Sans serif", FontWeight.BOLD, 24)
fill: Color.WHITE
}
]
}
]
}
}
For your convenience, here is a link to the JFXtras 0.2 API docs, as well as the JFXtras project itself.
Congratulations to the JFXtras project team for this 0.2 release, particularly Dean Iverson and Andres Almiray, and our fearless leader Stephen Chin :-)
Regards,
Jim Weaver
JavaFXpert.com
Comments