Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package sample;
- import javafx.application.Application;
- import javafx.event.ActionEvent;
- import javafx.event.EventHandler;
- import javafx.fxml.FXMLLoader;
- import javafx.geometry.Insets;
- import javafx.scene.Parent;
- import javafx.scene.Scene;
- import javafx.scene.control.Button;
- import javafx.scene.control.TextField;
- import javafx.scene.layout.*;
- import javafx.scene.control.Label;
- import javafx.stage.Stage;
- public class Main extends Application {
- Stage window;
- public static void main(String[] args) {
- launch(args);
- }
- @Override
- public void start(Stage primaryStage) throws Exception{
- window = primaryStage;
- window.setTitle("title");
- GridPane grid = new GridPane();
- grid.setPadding(new Insets(10,10,10,10));
- grid.setVgap(8);
- grid.setHgap(10);
- Label nameLabel = new Label("Username: ");
- GridPane.setConstraints(nameLabel,0,0);
- TextField nameInput = new TextField();
- nameInput.setPromptText("Type name here");
- GridPane.setConstraints(nameInput,1,0);
- Label passwordLabel = new Label("Password: ");
- GridPane.setConstraints(nameLabel,0,1);
- TextField passwordInput = new TextField();
- passwordInput.setPromptText("Type password here");
- GridPane.setConstraints(passwordLabel,1,1);
- Button login = new Button("Log In");
- GridPane.setConstraints(login,1,2);
- grid.getChildren().addAll(nameLabel,nameInput,passwordLabel,passwordInput,login);
- Scene scene = new Scene(grid,300,200);
- window.setScene(scene);
- window.show();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement