Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import javafx.application.Application;
- import javafx.stage.Stage;
- import javafx.geometry.Insets;
- import javafx.geometry.Pos;
- import javafx.scene.Scene;
- import javafx.scene.control.Button;
- import javafx.scene.layout.StackPane;
- import javafx.scene.layout.VBox;
- import java.util.List;
- import java.util.ArrayList;
- import javafx.scene.control.TextArea;
- public class z extends Application{
- @Override
- public void start(Stage primaryStage) {
- StackPane root = new StackPane();
- List<Button> buttonList = new ArrayList<Button>();
- Button insert = new Button("Insert File");
- buttonList.add(insert);
- Button clear = new Button("Clear Text");
- buttonList.add(clear);
- Button run = new Button("Run Utility");
- buttonList.add(run);
- run.setDisable(true);
- Button save = new Button("Save File");
- buttonList.add(save);
- Button help = new Button("Help");
- buttonList.add(help);
- Button about = new Button("About");
- buttonList.add(about);
- Button exit = new Button("Exit");
- buttonList.add(exit);
- for(Button btn :buttonList){
- btn.setPrefWidth(90);
- btn.setMaxWidth(90);
- }
- VBox vbox = new VBox();
- vbox.setAlignment(Pos.TOP_RIGHT);
- vbox.getChildren().addAll(buttonList);
- TextArea textArea = new TextArea();
- textArea.setPrefWidth(250);
- textArea.setMaxWidth(250);
- textArea.setText("Pole Tekstowe JTextArea.");
- Insets marg = new Insets(20,10,20,10);
- root.getChildren().add(textArea);
- root.getChildren().add(vbox);
- root.setMargin(textArea, marg);
- root.setMargin(vbox, marg);
- root.setAlignment(textArea, Pos.TOP_LEFT);
- root.setAlignment(vbox, Pos.TOP_RIGHT);
- Scene scene = new Scene(root, 450, 250);
- primaryStage.setMinWidth(390);
- primaryStage.setTitle("Text/File IO Utility");
- primaryStage.setScene(scene);
- primaryStage.show();
- }
- public static void main(String[] args) {
- launch(args);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement