本文整理汇总了Java中javafx.scene.layout.GridPane.lookup方法的典型用法代码示例。如果您正苦于以下问题:Java GridPane.lookup方法的具体用法?Java GridPane.lookup怎么用?Java GridPane.lookup使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.scene.layout.GridPane
的用法示例。
在下文中一共展示了GridPane.lookup方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getMainProgressDialog
import javafx.scene.layout.GridPane; //导入方法依赖的package包/类
private Dialog getMainProgressDialog() {
try {
FXMLLoader loader = new FXMLLoader(
getClass().getResource("/View/Payment.fxml")
);
Parent root = loader.load();
dialog = new Dialog();
dialog.setResizable(false);
dialog.setDialogPane((DialogPane) root);
dialog.initOwner(owner);
dialog.initModality(Modality.WINDOW_MODAL);
dialog.initStyle(StageStyle.UTILITY);
GridPane grid = (GridPane) dialog.getDialogPane().getContent();
totalPriceText = (Text) grid.lookup("#TotalCash");
paidPriceText = (Text) grid.lookup("#PaidPrice");
remindPriceText = (Text) grid.lookup("#RemindPrice");
updateText();
ButtonType closeButton = new ButtonType("취소", ButtonBar.ButtonData.CANCEL_CLOSE);
dialog.getDialogPane().getButtonTypes().addAll(closeButton);
cash = (Button) grid.lookup("#CashBtn");
card = (Button) grid.lookup("#CardBtn");
coupon = (Button) grid.lookup("#CouponBtn");
cash.setOnAction(this::cashProgressAction);
card.setOnAction(this::cardProgressAction);
coupon.setOnAction(this::couponProgressAction);
// Result converter for dialog
dialog.setResultConverter(param -> {
if (param != closeButton) {
return true;
}
System.out.println(param);
return false;
});
} catch (IOException e) {
System.out.println("Unable to load dialog FXML");
e.printStackTrace();
}
return dialog;
}
示例2: showCashPayProgress
import javafx.scene.layout.GridPane; //导入方法依赖的package包/类
private void showCashPayProgress() {
Dialog payDialog = getPayProgressDialog();
GridPane grid = (GridPane) dialog.getDialogPane().getContent();
TextField pay = (TextField) grid.lookup("#payPrice");
Text remind = (Text) grid.lookup("#remind");
remind.setText(String.valueOf(totalPrice - paidPrice));
ButtonType closeButton = new ButtonType("취소", ButtonBar.ButtonData.CANCEL_CLOSE);
ButtonType OkButton = new ButtonType("결제", ButtonBar.ButtonData.OK_DONE);
dialog.getDialogPane().getButtonTypes().addAll(closeButton, OkButton);
// Result converter for dialog
/* Todo 단순 취소, 결제 성공, 결제 금액 이상 나누어서 처리할 수 있어야함 */
dialog.setResultConverter(param -> {
if (param != closeButton) {
int money = 0;
try {
money = Integer.parseInt(pay.getText());
}catch(NumberFormatException e){
alert("에러메시지","숫자 외 문자 입력");
return "결제 금액 이상";
}
if(money == 0){
alert("에러메시지", "숫자 0 입력");
return "결제 금액 이상";
}
if(money > (totalPrice - paidPrice))
money = totalPrice - paidPrice;
if (!PaymentMoney(money)) {
return "결제 금액 이상";
}
if (paidPrice == totalPrice)
paymentStatus = false;
return "성공";
}
return "닫기";
});
Optional option = payDialog.showAndWait();
System.out.println(option.get());
}
示例3: showCardPayProgress
import javafx.scene.layout.GridPane; //导入方法依赖的package包/类
private void showCardPayProgress() {
Dialog payDialog = getPayProgressDialog();
GridPane grid = (GridPane) dialog.getDialogPane().getContent();
TextField pay = (TextField) grid.lookup("#payPrice");
Text remind = (Text) grid.lookup("#remind");
remind.setText(String.valueOf(totalPrice - paidPrice));
Label label = (Label) grid.lookup("#Label");
label.setText("카드 번호");
label.setVisible(true);
TextField input = (TextField) grid.lookup("#input");
input.setPromptText("카드 번호 입력");
input.setVisible(true);
ButtonType closeButton = new ButtonType("CANCEL", ButtonBar.ButtonData.CANCEL_CLOSE);
ButtonType OkButton = new ButtonType("결제", ButtonBar.ButtonData.OK_DONE);
dialog.getDialogPane().getButtonTypes().addAll(closeButton, OkButton);
// Result converter for dialog
/* Todo 단순 취소, 결제 성공, 결제 금액 이상 나누어서 처리할 수 있어야함 */
dialog.setResultConverter(param -> {
if (param != closeButton) {
int money = 0;
try {
money = Integer.parseInt(pay.getText());
}catch(NumberFormatException e){
alert("에러메시지","숫자 외 문자 입력");
return "결제 금액 이상";
}
if(money == 0){
alert("에러메시지", "숫자 0 입력");
return "결제 금액 이상";
}
if(money > (totalPrice - paidPrice))
money = totalPrice - paidPrice;
if (!PaymentCard(money, input.getText()))
return "결제 금액 이상";
if (paidPrice == totalPrice)
paymentStatus = false;
return "성공";
}
return "닫기";
});
Optional option = payDialog.showAndWait();
System.out.println(option.get());
}
示例4: showCouponPayProgress
import javafx.scene.layout.GridPane; //导入方法依赖的package包/类
private void showCouponPayProgress() {
Dialog payDialog = getPayProgressDialog();
GridPane grid = (GridPane) dialog.getDialogPane().getContent();
TextField pay = (TextField) grid.lookup("#payPrice");
Text remind = (Text) grid.lookup("#remind");
remind.setText(String.valueOf(totalPrice - paidPrice));
Label label = (Label) grid.lookup("#Label");
label.setText("쿠폰 번호");
label.setVisible(true);
TextField input = (TextField) grid.lookup("#input");
input.setVisible(true);
input.setPromptText("쿠폰 번호 입력");
ButtonType closeButton = new ButtonType("CANCEL", ButtonBar.ButtonData.CANCEL_CLOSE);
ButtonType OkButton = new ButtonType("결제", ButtonBar.ButtonData.OK_DONE);
dialog.getDialogPane().getButtonTypes().addAll(closeButton, OkButton);
// Result converter for dialog
/* Todo 단순 취소, 결제 성공, 결제 금액 이상 나누어서 처리할 수 있어야함 */
dialog.setResultConverter(param -> {
if (param != closeButton) {
int money = 0;
try {
money = Integer.parseInt(pay.getText());
}catch(NumberFormatException e){
alert("에러메시지","숫자 외 문자 입력");
return "결제 금액 이상";
}
if(money == 0){
alert("에러메시지", "숫자 0 입력");
return "결제 금액 이상";
}
if(money > (totalPrice - paidPrice))
money = totalPrice - paidPrice;
int result=PaymentCoupon(money, input.getText());
if (result==1) {
alert("에러메시지","쿠폰 번호 조회 불가");
return "결제 금액 이상";
}else if (result==2) {
alert("에러메시지","쿠폰 잔액 부족");
return "결제 금액 이상";
}
if (paidPrice == totalPrice)
paymentStatus = false;
return "성공";
}
return "닫기";
});
Optional option = payDialog.showAndWait();
System.out.println(option.get());
}