JavaFX Login Example Codes

This is example of a login form created using JavaFX

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.StackPane;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;

public class App extends Application  {
    private StackPane root = new StackPane();
    private Stage stage;

    public void init() {
        Button button = new Button("OPEN");
        VBox vBox = new VBox();

        vBox.setPadding(new Insets(10,10,10,10));
                new Label("Your Username"),
                new TextField(),
                new Label("Your Password"),
                new PasswordField(),
                new Button("LOGIN"));

        button.setOnAction(actionEvent-> {
            stage = new Stage();
            StackPane stackPane = new StackPane();
            stage.setScene(new Scene(stackPane, 200,200));

    public void start(Stage primaryStage) {
        Scene scene = new Scene(root,400,600);
        primaryStage.setTitle("Login Example JavaFX");

    public static void main(String[] args) {

login javafx
Login form javafx

JavaFX is good for creating cross-platform desktop application, you can literally doing simple UI to complex UI using JavaFX technology, it is my favorite framework powered by Java platform, you can build from simple to Enterprise level application, whatever application you want while codes is maintainable and can be deployed to wide variety of platform.


Popular posts from this blog

ASUS Battery Health Charging Software To Make Your Battery Life Longer

How To Create Spring Boot Project Using Netbeans

Flutter Button With Left Align Text and Icon

ERROR 1348 Column Password Is Not Updatable When Updating MySQL Root Password