本文整理汇总了Java中javafx.scene.layout.GridPane.setId方法的典型用法代码示例。如果您正苦于以下问题:Java GridPane.setId方法的具体用法?Java GridPane.setId怎么用?Java GridPane.setId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.scene.layout.GridPane
的用法示例。
在下文中一共展示了GridPane.setId方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: show
import javafx.scene.layout.GridPane; //导入方法依赖的package包/类
private void show() {
BorderPane bp = new BorderPane();
bp.setPadding(new Insets(10,50,50,50));
HBox hb = new HBox();
hb.setPadding(new Insets(20,20,20,30));
//Implementing Nodes for GridPane
Label lblUserName = new Label("Username");
Label lblPassword = new Label("Password");
Label lblLanguage = new Label("Language");
Button btnReset = createButton("Reset", "btnLogin");
Button btnRegister = createButton("Register", "btnReset");
Button btnLogin = createButton("Login", "btnReset");
//Adding GridPane
GridPane gridPane = createGridPane(lblUserName, lblPassword, lblLanguage, btnLogin, btnReset, btnRegister);
gridPane.setId("root");
Text text = createText("Game Login");
text.setId("text");
//Adding text to HBox
hb.getChildren().add(text);
//Add ID's to Nodes
bp.setId("bp");
//Add HBox and GridPane layout to BorderPane Layout
bp.setTop(hb);
bp.setCenter(gridPane);
//Adding BorderPane to the scene and loading CSS
scene = new Scene(bp);
scene.getStylesheets().setAll(CSS_LOCATION);
//Action for btnLogin
btnLogin.setOnAction(e -> buttonLoginAction());
//Action for btnReset
btnReset.setOnAction(e -> buttonResetAction());
//Action for btnRegister
btnRegister.setOnAction(p -> {
tempCheckUser = txtUserName.getText().toString();
tempCheckPw = pf.getText().toString();
if(tempCheckUser.length() < LENGTH_OF_USER || tempCheckPw.length() < LENGTH_OF_PASSWORD ){
MessageShowing unsuccess = new MessageShowing();
unsuccess.show("failure");
tempCheckUser="";
tempCheckPw = "";
buttonResetAction();
return;
}
usersModel.addUser(tempCheckUser, tempCheckPw);
writer.write(tempCheckUser, tempCheckPw);
((PopUpMessage) p).show("success");
buttonResetAction();});
scene.setOnKeyPressed(e -> handleKeyInput(e.getCode()));
}