Advertisement
MagnusArias

KCK | Zad 1

Sep 29th, 2016
243
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.97 KB | None | 0 0
  1. import javafx.application.Application;
  2. import javafx.stage.Stage;
  3.  
  4. import javafx.geometry.Insets;
  5. import javafx.geometry.Pos;
  6. import javafx.scene.Scene;
  7. import javafx.scene.control.Button;
  8. import javafx.scene.layout.StackPane;
  9. import javafx.scene.layout.VBox;
  10. import java.util.List;
  11. import java.util.ArrayList;
  12. import javafx.scene.control.TextArea;
  13.  
  14.  
  15. public class z extends Application{
  16. @Override
  17. public void start(Stage primaryStage) {
  18. StackPane root = new StackPane();
  19.  
  20. List<Button> buttonList = new ArrayList<Button>();
  21. Button insert = new Button("Insert File");
  22. buttonList.add(insert);
  23. Button clear = new Button("Clear Text");
  24. buttonList.add(clear);
  25. Button run = new Button("Run Utility");
  26. buttonList.add(run);
  27. run.setDisable(true);
  28. Button save = new Button("Save File");
  29. buttonList.add(save);
  30. Button help = new Button("Help");
  31. buttonList.add(help);
  32. Button about = new Button("About");
  33. buttonList.add(about);
  34. Button exit = new Button("Exit");
  35. buttonList.add(exit);
  36.  
  37. for(Button btn :buttonList){
  38. btn.setPrefWidth(90);
  39. btn.setMaxWidth(90);
  40. }
  41.  
  42. VBox vbox = new VBox();
  43. vbox.setAlignment(Pos.TOP_RIGHT);
  44. vbox.getChildren().addAll(buttonList);
  45.  
  46.  
  47. TextArea textArea = new TextArea();
  48. textArea.setPrefWidth(250);
  49. textArea.setMaxWidth(250);
  50. textArea.setText("Pole Tekstowe JTextArea.");
  51. Insets marg = new Insets(20,10,20,10);
  52.  
  53. root.getChildren().add(textArea);
  54. root.getChildren().add(vbox);
  55. root.setMargin(textArea, marg);
  56. root.setMargin(vbox, marg);
  57. root.setAlignment(textArea, Pos.TOP_LEFT);
  58. root.setAlignment(vbox, Pos.TOP_RIGHT);
  59.  
  60.  
  61.  
  62. Scene scene = new Scene(root, 450, 250);
  63.  
  64. primaryStage.setMinWidth(390);
  65. primaryStage.setTitle("Text/File IO Utility");
  66. primaryStage.setScene(scene);
  67. primaryStage.show();
  68. }
  69.  
  70. public static void main(String[] args) {
  71. launch(args);
  72. }
  73. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement