document.write('
Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. import javafx.application.Application;
  2. import javafx.geometry.Insets;
  3. import javafx.scene.Scene;
  4. import javafx.scene.control.Button;
  5. import javafx.scene.control.Label;
  6. import javafx.scene.layout.VBox;
  7. import javafx.scene.text.Font;
  8. import javafx.scene.text.FontWeight;
  9. import javafx.stage.Stage;
  10. /**
  11. *
  12. * @author zoranpavlovic.blogspot.com
  13. */
  14. public class VBoxMain extends Application {
  15. /**
  16. * @param args the command line arguments
  17. */
  18. public static void main(String[] args) {
  19. Application.launch(args);
  20. }
  21. @Override
  22. public void start(Stage primaryStage) {
  23. primaryStage.setTitle("VBox Test");
  24.  
  25. //VBox
  26. VBox vb = new VBox();
  27. vb.setPadding(new Insets(10, 50, 50, 50));
  28. vb.setSpacing(10);
  29.  
  30. //Adding label to VBox and setting font bold Amble CN with size 24
  31. Label lbl = new Label("VBox");
  32. lbl.setFont(Font.font("Amble CN", FontWeight.BOLD, 24));
  33. vb.getChildren().add(lbl);
  34.  
  35. //Buttons
  36. Button btn1 = new Button();
  37. btn1.setText("Button1");
  38. vb.getChildren().add(btn1);
  39.  
  40. Button btn2 = new Button();
  41. btn2.setText("Button2");
  42. vb.getChildren().add(btn2);
  43.  
  44. Button btn3 = new Button();
  45. btn3.setText("Button3");
  46. vb.getChildren().add(btn3);
  47.  
  48. Button btn4 = new Button();
  49. btn4.setText("Button4");
  50. vb.getChildren().add(btn4);
  51.  
  52. //Adding VBox to the scene
  53. Scene scene = new Scene(vb);
  54. primaryStage.setScene(scene);
  55. primaryStage.show();
  56. }
  57. }
');