The root layout in this case which has content...
object SomeApp extends JFXApp {
stage = new PrimaryStage {
title = "SomeApp"
width = 800
height = 600
val TheButton = new Button("Add a Button") {
onAction = {
e: ActionEvent => {
root.dd(new Button("Some Button"))
}
}
}
val SomeLayout = new AnchorPane {
styleClass += "someStyle"
content = TheButton
}
scene = new Scene {
stylesheets = List(getClass.getResource("Extend.css").toExternalForm)
root = new AnchorPane {
content = SomeLayout
}
}
}
}
I am trying to get it to add a button to the root layout when TheButton is clicked...
This works:
You just need to put the button in a reasonable place.
(BTW sorry for the long wait, scalafx is a low traffic tag)