Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.TableColumn;
import javafx.scene.control.TableView;
import javafx.scene.layout.StackPane;
import javafx.stage.Stage;

public class Main extends Application {
    public static void main(String[] args) {
        launch(args);
    }

    @Override
    public void start(Stage primaryStage) {
        TableView table = new TableView();
        table.setEditable(true);

        TableColumn firstNameCol = new TableColumn("First Name");
        TableColumn lastNameCol = new TableColumn("Last Name");
        TableColumn addressCol = new TableColumn("Email");

        table.getColumns().addAll(firstNameCol, lastNameCol, addressCol);

        TableColumn cityCol = new TableColumn("City");
        TableColumn stateCol = new TableColumn("State");

        addressCol.getColumns().addAll(cityCol, stateCol);

        StackPane root = new StackPane();
        root.getChildren().add(table);
        primaryStage.setScene(new Scene(root, 200, 250));
        primaryStage.show();
    }
}