Skip to content

Instantly share code, notes, and snippets.

@seungdols
Last active November 27, 2015 01:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save seungdols/15833a0a9faea0110e9d to your computer and use it in GitHub Desktop.
Save seungdols/15833a0a9faea0110e9d to your computer and use it in GitHub Desktop.
/*
* 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 login;
import javafx.application.Application;
import javafx.geometry.Pos;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.PasswordField;
import javafx.scene.control.TextField;
import javafx.scene.layout.GridPane;
import javafx.scene.layout.HBox;
import javafx.scene.paint.Color;
import javafx.scene.text.Font;
import javafx.scene.text.FontWeight;
import javafx.scene.text.Text;
import javafx.stage.Stage;
/**
*
* @author Administrator
*/
public class Login extends Application {
@Override
public void start(Stage primaryStage) {
primaryStage.setTitle("Hello World!");
GridPane grid = new GridPane();//그리드 패널 생성
grid.setAlignment(Pos.CENTER);//가운데 정렬
grid.setHgap(10);
grid.setVgap(10);
grid.setPadding(new javafx.geometry.Insets(25, 25, 25, 25));//상하좌우 간격 25픽셀
Scene scene = new Scene(grid, 300, 275);
primaryStage.setScene(scene);
Text sceneTitle = new Text("Welcome PManager");
sceneTitle.setFont(Font.font("Malgun Gothic", FontWeight.NORMAL, 20));
grid.add(sceneTitle, 0, 0, 2, 1);
javafx.scene.control.Label userName = new javafx.scene.control.Label("User Name : ");
grid.add(userName, 0, 1);
TextField userTField = new TextField();
grid.add(userTField, 1, 1);
javafx.scene.control.Label pw = new javafx.scene.control.Label("Password : ");
grid.add(pw, 0, 2);
PasswordField pwBox = new PasswordField();
grid.add(pwBox, 1, 2);
Button btn = new Button("Log in");
Button signBtn = new Button("Sign Up");
HBox hbBtn = new HBox(10);
hbBtn.setAlignment(Pos.BOTTOM_RIGHT);
hbBtn.getChildren().add(btn);
grid.add(hbBtn, 1, 4);
HBox hbSignBtn = new HBox(10);
hbSignBtn.setAlignment(Pos.BOTTOM_LEFT);
hbSignBtn.getChildren().add(signBtn);
grid.add(hbSignBtn, 0, 4);
final Text actionTarget = new Text();
grid.add(actionTarget, 1, 6);
btn.setOnAction(e -> {
actionTarget.setFill(Color.FIREBRICK);
actionTarget.setText("Log in");
});
primaryStage.show();
}
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
launch(args);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment