Advertisement
Guest User

Untitled

a guest
Jan 29th, 2020
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.00 KB | None | 0 0
  1. /*
  2. * To change this license header, choose License Headers in Project Properties.
  3. * To change this template file, choose Tools | Templates
  4. * and open the template in the editor.
  5. */
  6. package tp1;
  7.  
  8. import javafx.application.Application;
  9. import javafx.event.ActionEvent;
  10. import javafx.event.EventHandler;
  11. import javafx.geometry.Insets;
  12. import javafx.scene.Scene;
  13. import javafx.scene.control.Button;
  14. import javafx.scene.layout.FlowPane;
  15. import javafx.scene.layout.StackPane;
  16. import javafx.stage.Modality;
  17. import javafx.stage.Stage;
  18. import javafx.stage.StageStyle;
  19.  
  20. /**
  21. *
  22. * @author daekc
  23. */
  24. public class TP1 extends Application {
  25.  
  26. @Override
  27. public void start(Stage primaryStage) {
  28. //Stage secondStage = new Stage();
  29. FlowPane buttonFlow = new FlowPane();
  30. for(int i = 1; i <= 10;i++){
  31. Button btn = new Button();
  32. btn.setText("Bouton" + i);
  33. buttonFlow.getChildren().add(btn);
  34. buttonFlow.setMargin(btn, new Insets(4,4,4,4));
  35.  
  36. }
  37. StackPane root = new StackPane();
  38. root.getChildren().add(buttonFlow);
  39. Scene scene = new Scene(root, 500, 250);
  40. primaryStage.setTitle("TP1 : JavaFX");
  41. primaryStage.setFullScreen(true);
  42. //primaryStage.setMaximized(true);
  43. //primaryStage.setOpacity(0.5);
  44. //primaryStage.setResizable(false);
  45. primaryStage.setScene(scene);
  46. //primaryStage.initStyle(StageStyle.UTILITY);
  47. //secondStage.initModality(Modality.NONE);
  48. //secondStage.initOwner(primaryStage);
  49. primaryStage.show();
  50. //secondStage.setX(primaryStage.getX()+primaryStage.getWidth());
  51. //secondStage.setY(primaryStage.getY());
  52. //secondStage.setHeight(primaryStage.getHeight());
  53. //secondStage.setWidth(primaryStage.getWidth());
  54. //secondStage.show();
  55. }
  56.  
  57. /**
  58. * @param args the command line arguments
  59. */
  60. public static void main(String[] args) {
  61. launch(args);
  62. }
  63.  
  64. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement