Java/javaFX & Scene Builder

6주차 - javaFX PasswordField

우젼 2022. 9. 5. 20:49

PasswordField 는 생성된 필드에 입력한 값을 보여주지 않는 필드이다.

public class PasswordFieldEx extends Application {
	public static void main(String[] args) {
		launch(args);
	}

	@Override
	public void start(Stage primaryStage) throws Exception {
		PasswordField text1 = new PasswordField();
		PasswordField text2 = new PasswordField();
		
		
		text1.setPrefHeight(100);
		text1.setMaxWidth(200);
		VBox box = new VBox();
		box.getChildren().addAll(text1, text2);
		box.setAlignment(Pos.CENTER);
		box.setSpacing(30);
		
		primaryStage.setScene(new Scene(box,300,300));
		primaryStage.setTitle("PasswordFieldEx");
		primaryStage.show();
	}
}

실행 화면