Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
- package sample;
- import javafx.application.Application;
- import javafx.event.ActionEvent;
- import javafx.event.EventHandler;
- import javafx.scene.Scene;
- import javafx.scene.Parent;
- import javafx.geometry.Pos;
- import javafx.fxml.FXMLLoader;
- import javafx.scene.control.Button;
- import javafx.scene.control.Label;
- import javafx.scene.control.PasswordField;
- import javafx.scene.control.TextField;
- import javafx.scene.control.TextArea;
- import javafx.scene.layout.StackPane;
- import javafx.scene.layout.VBox;
- import javafx.stage.Stage;
- /**
- *
- * @author nashmin
- */
- public class Main extends Application implements EventHandler<ActionEvent>{
- Button button;
- @Override
- public void start(Stage primaryStage) {
- primaryStage.setTitle("Login Window");
- //the login button first
- button = new Button();
- button.setText("Login");
- button.setTranslateX(200.0);
- button.setTranslateY(300.0);
- button.setMaxWidth(80.0);
- //another button
- Button bottomButton = new Button();
- bottomButton.setTranslateX(200.0);
- bottomButton.setTranslateY(-150.0);
- bottomButton.setMaxWidth(80.0);
- //username
- Label userName = new Label("Username: ");
- userName.setTranslateX(-270.0);
- userName.setTranslateY(-250.0);
- //enter username
- TextField enterName = new TextField();
- enterName.setTranslateX(0.0);
- enterName.setTranslateY(-250.0);
- enterName.setMaxWidth((450));
- //password
- Label password = new Label("Password: ");
- password.setTranslateX(-270.0);
- password.setTranslateY(-200.0);
- //entering secret code
- PasswordField enterPass = new PasswordField();
- enterPass.setTranslateX(0);
- enterPass.setTranslateY(-200.0);
- enterPass.setMaxWidth(450.0);
- //huge textArea
- TextArea email = new TextArea();
- email.setTranslateX(0);
- email.setTranslateY(50.0);
- email.setMaxSize(450.0, 350.0);
- //another textfield
- TextField anotherText = new TextField();
- anotherText.setTranslateX(0.0);
- anotherText.setTranslateY(250.0);
- anotherText.setMaxWidth(450.0);
- StackPane displayBox = new StackPane(userName, enterName, password, enterPass, email, anotherText, bottomButton, button);
- Scene scene = new Scene(displayBox, 800, 700);
- primaryStage.setScene(scene);
- primaryStage.show();
- }
- @Override
- public void handle(ActionEvent event) {
- if(event.getSource()==button)
- System.out.println("you pressed a button");
- //throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
- }
- /**T
- * @param args the command line arguments
- */
- public static void main(String[] args) {
- launch(args);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement