Advertisement
Guest User

tmp03

a guest
Dec 19th, 2014
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Scala 0.78 KB | None | 0 0
  1. import scalafx.Includes._
  2. import scalafx.application.JFXApp
  3. import scalafx.application.JFXApp.PrimaryStage
  4. import scalafx.event.ActionEvent
  5. import scalafx.scene.Scene
  6. import scalafx.scene.control.Button
  7. import scalafx.scene.layout.VBox
  8.  
  9. object SomeApp extends JFXApp {
  10.  
  11.   stage = new PrimaryStage {
  12.     title = "SomeApp"
  13.     width = 800
  14.     height = 600
  15.  
  16.     val EmptyLayout = new VBox
  17.  
  18.     val TheButton = new Button("Add a Button") {
  19.       onAction = {
  20.         e: ActionEvent => {
  21.           EmptyLayout.content.addAll(new Button("Test"))
  22.         }
  23.       }
  24.     }
  25.  
  26.     val SomeLayout = new VBox {
  27.  
  28.       content = TheButton
  29.     }
  30.  
  31.     scene = new Scene {
  32.  
  33.       root = new VBox {
  34.  
  35.         content = SomeLayout
  36.         content += EmptyLayout
  37.       }
  38.     }
  39.   }
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement