Java/javaFX & Scene Builder
6주차 - javaFX TextField
우젼
2022. 9. 5. 21:06
TextField는 사용자가 입력가능한 한줄의 필드를 생성한다.
public class TextFieldEx01 extends Application{
public static void main(String[] args) {
launch(args);
}
@Override
public void start(Stage primaryStage) throws Exception {
TextField text1 = new TextField();
TextField text2 = new TextField();
text1.setMaxSize(180, 60);
text2.setMaxSize(180, 60);
text1.setText("아이디");
text2.setText("이름");
VBox box = new VBox();
box.getChildren().addAll(text1,text2);
box.setAlignment(Pos.CENTER);
primaryStage.setTitle("TextFieldEx");
primaryStage.setScene(new Scene(box,300,200));
primaryStage.show();
}
}