GUI sample using JavaFX

I made a form and a button with JAVA. The state where the connection function such as DB is not set yet only for display.

GUI.PNG

import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.control.TextField;
import javafx.scene.layout.GridPane;
import javafx.stage.Stage;

public class Sgn extends Application{
	Label label;
	Label label2;
	Label label3;
	TextField textField;
	TextField textField2;
	TextField textField3;
	Button button;

	public void start(Stage stage) {
		stage.setTitle("Employee master");
		stage.setWidth(800);
		stage.setHeight(700);


		label = new Label("ID:");
		label2 = new Label("Full name:");
		label3 = new Label("age:");
		textField = new TextField("Please enter your ID");
		textField2 = new TextField("Please enter your name");
		textField3 = new TextField("Please enter your age");


		Button button1 = new Button("Read");
		Button button2 = new Button("cancel");
		Button button3 = new Button("Decision");

		button1.setPrefSize(100, 50);
		button2.setPrefSize(100, 50);
		button3.setPrefSize(100, 50);

		GridPane root = new GridPane();
		GridPane.setConstraints(label, 0, 0);
		GridPane.setConstraints(label2, 0, 1);
		GridPane.setConstraints(label3, 0, 2);
		GridPane.setConstraints(textField, 1, 0);
		GridPane.setConstraints(textField2, 1, 1);
		GridPane.setConstraints(textField3, 1, 2);
		GridPane.setConstraints(button1, 2, 0);
		GridPane.setConstraints(button2, 3, 3);
		GridPane.setConstraints(button3, 4, 3);
		root.getChildren().addAll(label, label2, label3,textField, textField2, textField3, button1, button2, button3);


		Scene scene = new Scene(root);
		stage.setScene(scene);

		stage.show();

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

	}

}

Recommended Posts

GUI sample using JavaFX
Java GUI sample
A memorandum when trying to create a GUI using JavaFX
Serial communication sample using jSerialComm
Serial communication sample using purejavacomm
Sample to create GUI application with JavaFX + IntelliJ + Scene Builder
Sample code using Minio from Java
Sample code for Singleton implementation using enum