Design a JavaFx application for “Courier Management System”.
For your better understanding, I have divided the code into the following functions and I will be explaining you function-wise:
Login
Connect
Create/ Reset
User Menu
Admin Menu
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.layout.BorderPane;
import javafx.scene.layout.HBox;
import javafx.scene.layout.StackPane;
import javafx.stage.Stage;
public class Main extends Application {
@Override
public void start(Stage primaryStage) throws Exception {
BorderPane mainBorderPane = new BorderPane();
Button loginButton = new Button("Login");
loginButton.setOnMouseReleased(mouseEvent -> {
mainBorderPane.setCenter(new StackPane(new Label("Login")));
});
Button connectButton = new Button("Connect");
connectButton.setOnMouseReleased(mouseEvent -> {
mainBorderPane.setCenter(new StackPane(new Label("Connect")));
});
Button createResetButton = new Button("Create/Reset");
createResetButton.setOnMouseReleased(mouseEvent -> {
mainBorderPane.setCenter(new StackPane(new Label("Create/Reset")));
});
Button userMenuButton = new Button("User Menu");
userMenuButton.setOnMouseReleased(mouseEvent -> {
mainBorderPane.setCenter(new StackPane(new Label("User Menu")));
});
Button adminMenuButton = new Button("Admin Menu");
adminMenuButton.setOnMouseReleased(mouseEvent -> {
mainBorderPane.setCenter(new StackPane(new Label("Admin Menu")));
});
mainBorderPane.setBottom(new HBox(10, loginButton, connectButton,
createResetButton, userMenuButton, adminMenuButton));
primaryStage.setScene(new Scene(mainBorderPane, 400, 300));
primaryStage.show();
}
public static void main(String[] args) {
launch(args);
}
}
Comments
Leave a comment