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