import javafx.application.Application;
import javafx.geometry.Insets;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.control.PasswordField;
import javafx.scene.control.TextField;
import javafx.scene.layout.GridPane;
import javafx.scene.text.Text;
import javafx.stage.Stage;

public class Credentials extends Application {

    @Override
    public void start(Stage primaryStage) {
        primaryStage.setTitle("Login Form");

        GridPane grid = new GridPane();
        grid.setPadding(new Insets(10, 10, 10, 10));
        grid.setVgap(5);
        grid.setHgap(5);

        Label username = new Label("Username:");
        grid.add(username, 0, 0);

        TextField userTextField = new TextField();
        grid.add(userTextField, 1, 0);

        Label password = new Label("Password:");
        grid.add(password, 0, 1);

        PasswordField passwordField = new PasswordField();
        grid.add(passwordField, 1, 1);

        Button signInButton = new Button("Sign in");
        grid.add(signInButton, 1, 2);

        Text welcomeText = new Text();
        grid.add(welcomeText, 1, 3);

        signInButton.setOnAction(e -> {
            String name = userTextField.getText();
            welcomeText.setText("Welcome " + name);
        });

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

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