在这种情况下,根布局具有内容...
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
}
}
}
}
当单击 TheButton 时,我试图让它在根布局中添加一个按钮...