本文整理匯總了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());
}