Skip to content

Instantly share code, notes, and snippets.

@bitsnaps
Last active May 12, 2018 15:32
Show Gist options
  • Save bitsnaps/8a04c04519b22a9833a88cd5e0b9ddb1 to your computer and use it in GitHub Desktop.
Save bitsnaps/8a04c04519b22a9833a88cd5e0b9ddb1 to your computer and use it in GitHub Desktop.
GroovyFX using JFoenix simple login example
@Grapes([
@Grab('org.codehaus.groovyfx:groovyfx:0.4.0'),
@Grab('com.jfoenix:jfoenix:8.0.3')
])
import static groovyx.javafx.GroovyFX.start
import com.jfoenix.controls.*
start {
// you could use registerBeanFactory or use node()
//registerBeanFactory "textField", JFXTextField
//registerBeanFactory "passwordField", JFXPasswordField
registerBeanFactory "fxbutton", JFXButton
stage(title: 'GroovyFX with jFoenix', visible: true) {
scene(fill: BLACK, width: 300, height: 250) {
vbox(spacing: 10, padding: 60) {
//textField(labelFloat: true, promptText:"User Name", id: "user")
node(new JFXTextField(), labelFloat: true, promptText:"User Name", id: "user")
node(new JFXPasswordField(), style: "-fx-label-float:true;", promptText:"Password", id: "pass")
fxbutton("Login", onAction: {println("${user.text==pass.text?'Welcome '+user.text:'Wrong login'}")})
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment