import javafx.application.Application;
import javafx.geometry.Insets;
import javafx.geometry.Pos;
import javafx.scene.Scene;
import javafx.scene.control.TextArea;
import javafx.scene.layout.GridPane;
import javafx.stage.Stage;

public class NewClass extends Application {

    @Override
    public void start(Stage s) {
        GridPane grid = new GridPane();
        grid.setAlignment(Pos.CENTER);
        grid.setHgap(10);
        grid.setVgap(10);
        grid.setPadding(new Insets(25, 25, 25, 25));

        TextArea ta = new TextArea();
        ta.setText("Hello\nHello2\n");
        ta.appendText("Hello3");
        grid.add(ta, 0, 0, 2, 1);

        Scene scene = new Scene(grid, 300, 200);
        s.setScene(scene);
        s.show();
    }

    public static void main(String[] args) {
        launch(args);
    }
}

執行結果:

PrtScr capture  






arrow
arrow
    全站熱搜

    黃彥霖 發表在 痞客邦 留言(0) 人氣()