本文整理汇总了Java中javafx.stage.Stage.showAndWait方法的典型用法代码示例。如果您正苦于以下问题:Java Stage.showAndWait方法的具体用法?Java Stage.showAndWait怎么用?Java Stage.showAndWait使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.stage.Stage
的用法示例。
在下文中一共展示了Stage.showAndWait方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addTransition
import javafx.stage.Stage; //导入方法依赖的package包/类
protected void addTransition (String typeName) {
System.out.println("add transition: " + typeName);
//get fxml path
String fxmlPath = Transition.getTransitionByType(typeName).getFXMLPath();
FXMLWindow dialog = null;
try {
dialog = new FXMLWindow("Add Transition", 440, 240, fxmlPath, Transition.getTransitionByType(typeName).createFXMLController(this, entry, index));
} catch (Exception e) {
JavaFXUtils.showExceptionDialog("Exception", "Cannot add transition, exception was thrown. Please copy this stacktrace and send it to developers!", e);
return;
}
Stage stage = dialog.getStage();
stage.hide();
stage.initModality(Modality.WINDOW_MODAL);
stage.initOwner(this.stage);
stage.showAndWait();
refreshListView();
}
示例2: openPackageDetails
import javafx.stage.Stage; //导入方法依赖的package包/类
public static void openPackageDetails(PackageType pkg, List<CrxPackage> packageList, AuthHandler handler) {
try {
FXMLLoader loader = new FXMLLoader(EpicApp.class.getResource("/fxml/PackageInfo.fxml"));
loader.setResources(ApplicationState.getInstance().getResourceBundle());
loader.load();
PackageInfoController runnerActivityController = loader.getController();
Stage popup = new Stage();
popup.setTitle(pkg.getName() + " (" + pkg.getVersion() + ")");
popup.setScene(new Scene(loader.getRoot()));
popup.initModality(Modality.NONE);
popup.initOwner(applicationWindow);
runnerActivityController.setAuthHandler(handler);
runnerActivityController.setPackage(pkg, packageList);
popup.showAndWait();
} catch (IOException ex) {
Logger.getLogger(EpicApp.class.getName()).log(Level.SEVERE, null, ex);
}
}
示例3: showGithubLoginDialog
import javafx.stage.Stage; //导入方法依赖的package包/类
public GithubLoginDialogController showGithubLoginDialog(){
GithubLoginDialogController controller = null;
try {
FXMLLoader loader = new FXMLLoader(getClass().getClassLoader().getResource("com/kaanburaksener/octoUML/src/view/fxml/githubLoginDialog.fxml"));
AnchorPane page = loader.load();
Stage dialogStage = new Stage();
dialogStage.initModality(Modality.WINDOW_MODAL);
dialogStage.initOwner(this.stage);
dialogStage.setScene(new Scene(page));
controller = loader.getController();
controller.setDialogStage(dialogStage);
dialogStage.showAndWait();
} catch (IOException e){
e.printStackTrace();
}
return controller;
}
示例4: createAccount
import javafx.stage.Stage; //导入方法依赖的package包/类
/**
* Displays a 'Create Account' window and handles the creation of
* a new Account object
*
* @return newly created Account
* @throws Exception
*/
public Account createAccount() throws Exception
{
AccountController accountControl = new AccountController();
System.setProperty("com.apple.mrj.application.apple.menu.about.name", "Hello World!");
// Load in the .fxml file:
FXMLLoader loader = new FXMLLoader(getClass().getResource("/View/CreateAccount.fxml"));
loader.setController(accountControl);
Parent root = loader.load();
// Set the scene:
Stage stage = new Stage();
stage.setScene(new Scene(root, 550, 232));
stage.setTitle("Create Account");
stage.resizableProperty().setValue(false);
stage.getIcons().add(new Image("file:icon.png"));
stage.showAndWait();
// Handle creation of the Account object:
if (accountControl.isSuccess())
{
Account newAccount = accountControl.getAccount();
return newAccount;
} else
throw new Exception("User quit.");
}
示例5: display
import javafx.stage.Stage; //导入方法依赖的package包/类
public static void display(String title, String message)
{
Stage window= new Stage();
window.initModality(Modality.APPLICATION_MODAL);
//window.setAlwaysOnTop(true);
window.getIcons().add(new Image("/pic/slogo.png"));
window.setTitle(title);
Label label= new Label();
label.setText(message);
label.setStyle("-fx-font-size:14px;");
ImageView imageView = new ImageView(ICON);
imageView.setFitWidth(40);
imageView.setFitHeight(40);
Label labelimage = new Label("",imageView);
// two buttons
Button okbtn= new Button("Ok");
okbtn.setOnAction(e -> {
answer= false;
window.close();
});
okbtn.setId("red");
HBox hbox= new HBox(10);
hbox.setAlignment(Pos.CENTER_LEFT);
hbox.setPadding(new Insets(10,5,10,5));
hbox.getChildren().addAll(labelimage,label);
VBox layout= new VBox(15);
layout.setAlignment(Pos.CENTER_RIGHT);
layout.setPadding(new Insets(10,5,10,5));
layout.getChildren().addAll(hbox,okbtn);
layout.setStyle("-fx-background-color: linear-gradient(#E4EAA2, #9CD672);");
Scene scene= new Scene(layout);
scene.getStylesheets().add(ErrorMessage.class.getResource("confirm.css").toExternalForm());
window.setScene(scene);
window.setResizable(false);
window.showAndWait();
}
示例6: onBtnChangePiccKeyClicked
import javafx.stage.Stage; //导入方法依赖的package包/类
@FXML
private void onBtnChangePiccKeyClicked(ActionEvent event) {
try {
SmartcardIoTransmitter transmitter = SmartcardIoTransmitter.create();
ApduSession session = new ApduSession();
session.nextCommands(new GetVersion());
session.transmit(transmitter);
FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("fxml/ChangePiccKey.fxml"));
Parent root = (Parent)fxmlLoader.load();
ChangePiccKeyController controller = fxmlLoader.<ChangePiccKeyController>getController();
String curr_key = checkUseKeyDiv()
? edDiversificationKey.getText()
: (edNoDivKey.isDisable()?"":edNoDivKey.getText());
controller.setSession(session, historyData, checkUseKeyDiv(), curr_key,
cbTypes.getValue().equals("AES"));
Stage stage = new Stage();
stage.setTitle("Change PICC Key");
stage.setScene(new Scene(root, 450, 300));
stage.showAndWait();
} catch (Exception e) {
lbResultTabApp.setText(e.getMessage());
}
}
示例7: showValuePanel
import javafx.stage.Stage; //导入方法依赖的package包/类
/** 显示值输入窗口.
* @param isNum 是否选择整数类型, true为整数, false为字符串
*/
public boolean showValuePanel(boolean isNum) {
// 创建 FXMLLoader 对象
FXMLLoader loader = new FXMLLoader();
// 加载文件
loader.setLocation(this.getClass().getResource("/views/ListAddLayout.fxml"));
AnchorPane pane = null;
try {
pane = loader.load();
} catch (IOException e) {
e.printStackTrace();
}
// 创建对话框
Stage dialogStage = new Stage();
dialogStage.setTitle("添加值");
dialogStage.initModality(Modality.WINDOW_MODAL);
Scene scene = new Scene(pane);
dialogStage.setScene(scene);
controller = loader.getController();
controller.setDialogStage(dialogStage);
if (isNum) {
controller.setTipText("输入0便立即删除\n-1 则永久存活 \n-2 则不存在");
controller.setFlag("number");
}
// 显示对话框, 并等待, 直到用户关闭
dialogStage.showAndWait();
return controller.isOkChecked();
}
示例8: addTask
import javafx.stage.Stage; //导入方法依赖的package包/类
/**
* Creates a window for adding a new Task
*
* @return newly created Task
*/
public Task addTask() throws Exception
{
TaskController tc = new TaskController();
// Load in the .fxml file:
FXMLLoader loader = new FXMLLoader(getClass().getResource("/View/Task.fxml"));
loader.setController(tc);
Parent root = loader.load();
// Set the scene:
Stage stage = new Stage();
stage.initModality(Modality.APPLICATION_MODAL);
stage.setScene(new Scene(root, 550, 558));
stage.setTitle("New Task");
stage.resizableProperty().setValue(false);
stage.getIcons().add(new Image("file:icon.png"));
stage.showAndWait();
// Handle creation of the Account object:
if (tc.isSuccess())
return tc.getTask();
return null;
}
示例9: display
import javafx.stage.Stage; //导入方法依赖的package包/类
public static void display(String title, String message)
{
Stage window= new Stage();
window.initModality(Modality.APPLICATION_MODAL);
window.setAlwaysOnTop(true);
window.getIcons().add(new Image("/pic/slogo.png"));
window.setTitle(title);
Label label= new Label();
label.setText(message);
label.setStyle("-fx-font-size:14px;");
ImageView imageView = new ImageView(ICON);
imageView.setFitWidth(40);
imageView.setFitHeight(40);
Label labelimage = new Label("",imageView);
// two buttons
Button okbtn= new Button("Ok");
okbtn.setOnAction(e -> {
answer= false;
window.close();
});
okbtn.setId("blue");
HBox hbox= new HBox(10);
hbox.setAlignment(Pos.CENTER_LEFT);
hbox.setPadding(new Insets(10,5,10,5));
hbox.getChildren().addAll(labelimage,label);
VBox layout= new VBox(15);
layout.setAlignment(Pos.CENTER_RIGHT);
layout.setPadding(new Insets(10,5,10,5));
layout.getChildren().addAll(hbox,okbtn);
layout.setStyle("-fx-background-color: linear-gradient(#E4EAA2, #9CD672);");
Scene scene= new Scene(layout);
window.setScene(scene);
scene.getStylesheets().add(SuccessMessage.class.getResource("confirm.css").toExternalForm());
window.setResizable(false);
window.showAndWait();
}
示例10: addOnMousePressed
import javafx.stage.Stage; //导入方法依赖的package包/类
@FXML
private void addOnMousePressed() {
try {
Stage window = new Stage();
Parent root = FXMLLoader.load(getClass().getResource("/com/kinmanlui/fxml/EditorScene.fxml"));
window.initModality(Modality.APPLICATION_MODAL);
window.setResizable(false);
window.setScene(new Scene(root));
window.showAndWait();
} catch(IOException e) {
e.printStackTrace();
}
}
示例11: addTimeCondition
import javafx.stage.Stage; //导入方法依赖的package包/类
@FXML
private void addTimeCondition() {
TimeContextConditionEditor dlg = new TimeContextConditionEditor();
Stage stage = ControlsHelper.createModalStageFor(this, dlg, "Create condition");
dlg.setCondition(new TimeContextCondition(station));
stage.showAndWait();
connectData();
}
示例12: onInsertChecklist
import javafx.stage.Stage; //导入方法依赖的package包/类
public void onInsertChecklist() {
String checklistDir = System.getProperty(Constants.PROP_CHECKLIST_DIR);
File dir = new File(checklistDir);
CheckListForm checkListInfo = new CheckListForm(dir, true);
MarathonCheckListStage checklistStage = new MarathonCheckListStage(checkListInfo);
checklistStage.setInsertCheckListHandler(new IInsertCheckListHandler() {
@Override public boolean insert(CheckListElement selectedItem) {
insertChecklist(selectedItem.getFile().getName());
return true;
}
});
Stage stage = checklistStage.getStage();
stage.showAndWait();
}
示例13: createAndShowTableWindow
import javafx.stage.Stage; //导入方法依赖的package包/类
private void createAndShowTableWindow(ComboBox<String> traceNameComboBox) {
openedWindowsCtr++;
List<String> traceNames = new ArrayList<>();
for (int i = 0; i < plotData.getAllTraces().size(); i++) {
traceNames.add(plotData.getAllTraces().get(i).getTraceName());
}
traceNameComboBox.setItems(FXCollections.observableList(traceNames));
traceNameComboBox.getSelectionModel().select(0);
HBox hbox = new HBox();
traceNameComboBox.getSelectionModel().select(0);
Region spacer = new Region();
HBox.setHgrow(spacer, Priority.ALWAYS);
hbox.getChildren().addAll(new Label("Please Select a trace :"), spacer, traceNameComboBox);
updateTableValues(traceNameComboBox);
Scene scene = new Scene(new Group());
VBox vbox = new VBox();
VBox.setVgrow(table, Priority.ALWAYS);
vbox.setSpacing(5);
vbox.setPadding(new Insets(10, 10, 10, 10));
vbox.prefWidthProperty().bind(scene.widthProperty());
vbox.prefHeightProperty().bind(scene.heightProperty());
vbox.getChildren().addAll(hbox, table);
((Group) scene.getRoot()).getChildren().addAll(vbox);
Stage stage = new Stage();
stage.setOnCloseRequest(e -> closeTableWindow());
stage.setWidth(300);
stage.setHeight(400);
stage.setScene(scene);
stage.sizeToScene();
stage.showAndWait();
}
示例14: setCanvasSize
import javafx.stage.Stage; //导入方法依赖的package包/类
/**
* 设置canvas大小
*/
private void setCanvasSize() {
try {
FXMLLoader fxmlLoader = new FXMLLoader((getClass().getResource("size_chooser.fxml")));
Parent root1 = fxmlLoader.load();
Stage stage = new Stage(DECORATED);
stage.setTitle("选择画布");
Scene scene = new Scene(root1);
sizeChooser = fxmlLoader.getController();
stage.setScene(scene);
stage.showAndWait();
if (sizeChooser.getCanvas() != null) {
canvas.setHeight(sizeChooser.getCanvas().getHeight());
canvas.setWidth(sizeChooser.getCanvas().getWidth());
canvas.setLayoutX(450 - canvas.getWidth() / 2);
canvas.setLayoutY(300 - canvas.getHeight() / 2);
Rectangle rectangle = new Rectangle(canvas.getWidth(), canvas.getHeight());
rectangle.setLayoutX(canvas.getLayoutX());
rectangle.setLayoutY(canvas.getLayoutY());
mainPane.setClip(rectangle);
GraphicsContext gc = canvas.getGraphicsContext2D();
gc.setFill(Color.WHITE);
gc.fillRect(0, 0, canvas.getWidth(), canvas.getHeight());
} else {
//不选择就退出程序
System.exit(0);
}
} catch (IOException e) {
e.printStackTrace();
}
}
示例15: humanActions
import javafx.stage.Stage; //导入方法依赖的package包/类
@Override
protected void humanActions(Player p) {
try {
FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("ActionsFXML.fxml"));
Parent root1 = (Parent) fxmlLoader.load();
ActionsFXMLController actionCtrl = fxmlLoader.getController();
actionCtrl.setPlayer(p);
actionCtrl.setBackground(background);
Stage stage = new Stage();
stage.initModality(Modality.APPLICATION_MODAL);
//Pour click sur close de action
stage.setOnCloseRequest((WindowEvent event) -> {
// consume event
event.consume();
// show close dialog
Alert alert = new Alert(AlertType.ERROR);
alert.setTitle("Pas de précipitation !");
alert.setHeaderText(null);
alert.setContentText("Vous devez choisir 6 actions !\nNe pas oublier de choisir la région pour les délégations.");
alert.showAndWait();
});
stage.setTitle("Choix des actions");
stage.setScene(new Scene(root1));
stage.showAndWait();
} catch (IOException ex) {
Logger.getLogger(PlayGraphic.class.getName()).log(Level.SEVERE, null, ex);
}
}