当前位置: 首页>>代码示例>>Java>>正文


Java Stage.initOwner方法代码示例

本文整理汇总了Java中javafx.stage.Stage.initOwner方法的典型用法代码示例。如果您正苦于以下问题:Java Stage.initOwner方法的具体用法?Java Stage.initOwner怎么用?Java Stage.initOwner使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javafx.stage.Stage的用法示例。


在下文中一共展示了Stage.initOwner方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: showPersonDialog

import javafx.stage.Stage; //导入方法依赖的package包/类
public boolean showPersonDialog(Person person) throws IOException {
    FXMLLoader loader = new FXMLLoader();
    loader.setLocation(this.getClass().getResource("personDialog.fxml"));
    GridPane dialog = loader.load();

    Stage dialogStage = new Stage();
    dialogStage.initModality(Modality.WINDOW_MODAL);
    dialogStage.initOwner(stage);
    Scene scene = new Scene(dialog);
    dialogStage.setScene(scene);

    PersonDialogController pdc = loader.getController();
    pdc.setDialogStage(dialogStage);
    pdc.setPerson(person);

    dialogStage.showAndWait();
    return pdc.isOkButtonClicked();
}
 
开发者ID:biblelamp,项目名称:QAExercises,代码行数:19,代码来源:Main.java

示例2: onResetEmployeePasswordButtonClicked

import javafx.stage.Stage; //导入方法依赖的package包/类
/**
 * Displays the reset password dialog for the currently selected employee.
 *
 * @throws IOException
 */
@FXML
private void onResetEmployeePasswordButtonClicked() throws IOException {
    Stage dialogStage = new Stage();
    FXMLLoader loader = new FXMLLoader(
        getClass().getResource("/fxml/ResetEmployeePasswordDialog.fxml")
    );
    Parent dialogRoot = loader.load();
    Scene resetPasswordDialog = new Scene(dialogRoot);
    dialogStage.getIcons().add(new Image("images/Logo.png"));
    dialogStage.setScene(resetPasswordDialog);
    dialogStage.initModality(Modality.APPLICATION_MODAL);
    dialogStage.initOwner(resetEmployeePasswordButton.getScene().getWindow());
    dialogStage.setResizable(false);
    dialogStage.setTitle("Confirm");
    dialogStage.centerOnScreen();

    ResetEmployeePasswordDialogController c;
    c = (ResetEmployeePasswordDialogController) loader.getController();
    long employeeId = getSelectedEmployee().getId();
    c.setEmployeeId(employeeId);

    dialogStage.show();
}
 
开发者ID:maillouxc,项目名称:git-rekt,代码行数:29,代码来源:StaffAccountsScreenController.java

示例3: showPackageDiff

import javafx.stage.Stage; //导入方法依赖的package包/类
public static void showPackageDiff(PackageType left, PackageType right, AuthHandler handler) {
    try {
        FXMLLoader loader = new FXMLLoader(EpicApp.class.getResource("/fxml/PackageCompare.fxml"));
        loader.setResources(ApplicationState.getInstance().getResourceBundle());
        loader.load();
        PackageCompareController runnerActivityController = loader.getController();

        Stage popup = new Stage();
        popup.setTitle("Package Comparison");
        popup.setScene(new Scene(loader.getRoot()));
        popup.initModality(Modality.NONE);
        popup.initOwner(applicationWindow);

        runnerActivityController.initDiffView(left, right, handler);

        popup.showAndWait();
    } catch (IOException ex) {
        Logger.getLogger(EpicApp.class.getName()).log(Level.SEVERE, null, ex);
    }
}
 
开发者ID:Adobe-Consulting-Services,项目名称:aem-epic-tool,代码行数:21,代码来源:EpicApp.java

示例4: showAppEditDialog

import javafx.stage.Stage; //导入方法依赖的package包/类
public boolean showAppEditDialog(Entry e) throws Exception {
	FXMLLoader loader = new FXMLLoader();
	loader.setLocation(MainApp.class.getResource("view/AppEditDialog.fxml"));
	AnchorPane page = (AnchorPane) loader.load();
	
	// Create the dialog Stage.
       Stage dialogStage = new Stage();
       dialogStage.setTitle("Edit Entry");
       dialogStage.initModality(Modality.WINDOW_MODAL);
       dialogStage.initOwner(primaryStage);
       Scene scene = new Scene(page);
       dialogStage.setScene(scene);

       // Set the person into the controller.
       AppEditDialogController controller = loader.getController();
       controller.setDialogStage(dialogStage);
       controller.setEntry(e);

       // Show the dialog and wait until the user closes it
       dialogStage.setResizable(false);
       dialogStage.showAndWait();
       
       return controller.isOkClicked();
}
 
开发者ID:yc45,项目名称:kanphnia2,代码行数:25,代码来源:MainApp.java

示例5: handleSaveGame

import javafx.stage.Stage; //导入方法依赖的package包/类
/**
 * Opens a dialog to save the game
 */
@FXML
protected void handleSaveGame() {
    try {
        // Load game saving view
        FXMLLoader loader = new FXMLLoader();
        loader.setResources(this.scrabble.getI18nMessages());
        loader.setLocation(Scrabble.class.getResource("view/SaveGame.fxml"));
        VBox page = loader.load();

        // Create the dialog stage
        Stage dialogStage = new Stage();
        dialogStage.setMinWidth(SaveGameController.STAGE_WIDTH);
        dialogStage.setMaxWidth(SaveGameController.STAGE_WIDTH);
        dialogStage.setMinHeight(SaveGameController.STAGE_HEIGHT);
        dialogStage.setMaxHeight(SaveGameController.STAGE_HEIGHT);

        dialogStage.setTitle(this.scrabble.getI18nMessages().getString("save"));
        dialogStage.initModality(Modality.WINDOW_MODAL);
        dialogStage.initOwner(this.scrabble.getPrimaryStage());

        Scene scene = new Scene(page);
        dialogStage.setScene(scene);

        SaveGameController controller = loader.getController();
        controller.setDialogStage(dialogStage);
        controller.setScrabble(this.scrabble);

        dialogStage.showAndWait();
    } catch (IOException e) {
        this.scrabble.showGeneralApplicationError(e);
    }
}
 
开发者ID:Chrisp1tv,项目名称:ScrabbleGame,代码行数:36,代码来源:GameController.java

示例6: onEditPriceClickedButton

import javafx.stage.Stage; //导入方法依赖的package包/类
@FXML
private void onEditPriceClickedButton() throws IOException {

    Stage editPriceDialogStage = new Stage();
    Parent editPriceDialogRoot = FXMLLoader.load(
            getClass().getResource("/fxml/EditPriceDialog.fxml")
    );
    service = roomTableView.getSelectionModel().getSelectedItem();
    Scene editPriceDialog = new Scene(editPriceDialogRoot);

    editPriceDialogStage.getIcons().add(new Image("images/Logo.png"));
    editPriceDialogStage.setScene(editPriceDialog);
    editPriceDialogStage.initModality(Modality.APPLICATION_MODAL);
    editPriceDialogStage.initOwner(editPriceButton.getScene().getWindow());
    editPriceDialogStage.setResizable(false);
    editPriceDialogStage.setTitle("Edit Price");
    editPriceDialogStage.centerOnScreen();
    editPriceDialogStage.show();

}
 
开发者ID:maillouxc,项目名称:git-rekt,代码行数:21,代码来源:EditPricesScreenController.java

示例7: showDialog

import javafx.stage.Stage; //导入方法依赖的package包/类
public static FXMLLoader showDialog(Stage owner, String title, String fxmlPath) {
    FXMLLoader fxmlLoader = loadFxml(fxmlPath);

    Stage dialogStage = new Stage();
    dialogStage.setTitle(title);

    if (owner != null) {
        dialogStage.initOwner(owner);
        dialogStage.initModality(Modality.WINDOW_MODAL);
    }

    Object controller = fxmlLoader.getController();
    if (controller instanceof BaseController) {
        ((BaseController) controller).setStage(dialogStage);
    }

    Icons.Logo.setToStage(dialogStage);

    dialogStage.setScene(new Scene(fxmlLoader.getRoot()));
    dialogStage.show();
    return fxmlLoader;
}
 
开发者ID:yiding-he,项目名称:redisfx,代码行数:23,代码来源:Fx.java

示例8: ProgressBarView

import javafx.stage.Stage; //导入方法依赖的package包/类
/**
 * Create instance of {@link ProgressBarView}.
 */
public ProgressBarView() {
    try {
        final Stage newStage = new Stage();
        newStage.setResizable(false);

        final URL resource = getClass().getResource(PROGRESS_BAR_VIEW);
        fxmlLoader = new FXMLLoader(resource);

        final Stage primaryStage = Hygene.getInstance().getPrimaryStage();
        newStage.initOwner(primaryStage);
        newStage.initStyle(StageStyle.UTILITY);
        newStage.initModality(Modality.APPLICATION_MODAL);

        final double centerXPosition = primaryStage.getX() + primaryStage.getWidth() / 2;
        final double centerYPosition = primaryStage.getY() + primaryStage.getHeight() / 2;

        newStage.setOnShowing(event -> newStage.hide());
        newStage.setOnShown(event -> {
            newStage.setX(centerXPosition - newStage.getWidth() / 2);
            newStage.setY(centerYPosition - newStage.getHeight() / 2);
            newStage.show();
        });

        setStage(newStage);
    } catch (final UIInitialisationException e) {
        LOGGER.error("Progress bar view could not be loaded.", e);
    }
}
 
开发者ID:ProgrammingLife2017,项目名称:hygene,代码行数:32,代码来源:ProgressBarView.java

示例9: SettingsView

import javafx.stage.Stage; //导入方法依赖的package包/类
/**
 * Create a new instance of a {@link SettingsView}.
 *
 * @param settings   {@link Settings} of the application
 * @param fxmlLoader a {@link FXMLLoader} instance for instantiating the new window
 */
@Inject
public SettingsView(final Settings settings, final FXMLLoader fxmlLoader) {
    try {
        final Stage newStage = new Stage();
        newStage.setResizable(false);
        newStage.setTitle(TITLE);

        final URL resource = getClass().getResource(SETTINGS_VIEW);
        fxmlLoader.setLocation(resource);
        final Parent parent = fxmlLoader.load();
        if (parent == null) {
            throw new UIInitialisationException("Root of Settings could not be found.");
        }

        final Stage primaryStage = Hygene.getInstance().getPrimaryStage();
        newStage.initModality(Modality.WINDOW_MODAL);
        newStage.initOwner(primaryStage);
        newStage.setScene(new Scene(parent));

        // TODO show prompt box asking the user if they want to close if they have unsaved settings.
        newStage.setOnCloseRequest(request -> settings.clearAll());

        setStage(newStage);
    } catch (final IOException | UIInitialisationException e) {
        LOGGER.error("Unable to initialize SettingsView.", e);
    }
}
 
开发者ID:ProgrammingLife2017,项目名称:hygene,代码行数:34,代码来源:SettingsView.java

示例10: showGithubRepoDialog

import javafx.stage.Stage; //导入方法依赖的package包/类
public GithubRepoDialogController showGithubRepoDialog(){
    GithubRepoDialogController controller = null;
    try {
        FXMLLoader loader = new FXMLLoader(getClass().getClassLoader().getResource("com/kaanburaksener/octoUML/src/view/fxml/githubRepoDialog.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;

}
 
开发者ID:kaanburaksener,项目名称:octoBubbles,代码行数:20,代码来源:TabController.java

示例11: openDownloader

import javafx.stage.Stage; //导入方法依赖的package包/类
@FXML
public void openDownloader(ActionEvent actionEvent) throws IOException {
    Stage stage = new Stage();
    stage.initModality(Modality.APPLICATION_MODAL);
    stage.initOwner(this.tableView.getScene().getWindow());

    Parent root = FXMLLoader.load(getClass().getResource("/Downloader.fxml"));
    root.getStylesheets().add(this.getClass().getResource(Main.properties.getProperty("css")).toExternalForm());
    javafx.scene.Scene scene = new javafx.scene.Scene(root);
    stage.setScene(scene);
    stage.setTitle("鳳凰卓牌譜ダウンロード");
    stage.show();

    stage.setOnHiding(event -> {
        this.tableView.getItems().clear();
        this.tableView.getItems().addAll(this.databaseService.findAllExistsInfos());
    });
}
 
开发者ID:CrazyBBB,项目名称:tenhou-visualizer,代码行数:19,代码来源:AppController.java

示例12: loadFXMLPage

import javafx.stage.Stage; //导入方法依赖的package包/类
public BaseController loadFXMLPage(String title, FXMLPage fxmlPage, boolean cache) {
    SoftReference<? extends BaseController> parentNodeRef = cacheNodeMap.get(fxmlPage);
    if (cache && parentNodeRef != null) {
        return parentNodeRef.get();
    }
    URL skeletonResource = Thread.currentThread().getContextClassLoader().getResource(fxmlPage.getFxml());
    
    FXMLLoader loader = new FXMLLoader(skeletonResource);
   
    Parent loginNode;
    try {
        loginNode = loader.load();
        BaseController controller = loader.getController();
        dialogStage = new Stage();
        dialogStage.setTitle(title);
        dialogStage.getIcons().add(new Image("image/icon.png"));
        dialogStage.initModality(Modality.APPLICATION_MODAL);
        dialogStage.initOwner(getPrimaryStage());
        dialogStage.setScene(new Scene(loginNode));
        dialogStage.setMaximized(false);
        dialogStage.setResizable(false);
        dialogStage.show();
        controller.setDialogStage(dialogStage);
        SoftReference<BaseController> softReference = new SoftReference<>(controller);
        cacheNodeMap.put(fxmlPage, softReference);
        return controller;
    } catch (IOException e) {
        AlertUtil.showErrorAlert(e.getMessage());
    }
    return null;
}
 
开发者ID:shenzhenMirren,项目名称:vertx-generator,代码行数:32,代码来源:BaseController.java

示例13: create

import javafx.stage.Stage; //导入方法依赖的package包/类
private BaseDialog create() {
        mStage = new Stage();
        mStage.initModality(Modality.WINDOW_MODAL);
        mStage.initOwner(getOwner());
        mStage.initStyle(StageStyle.DECORATED);
        mStage.setResizable(false);
        viewTuple = createContent();
        BaseView view = null;
        if(viewTuple.getView() instanceof BaseView){
            view = (BaseView) viewTuple.getView();
            view.onDialogSet(this);
            root = (Pane) viewTuple.getRoot();
            alignCenter(root.getPrefWidth(), root.getPrefHeight());
            if(isDragable)
                dragDialogAbleNode(root);
        } else {
            try {
                throw new Exception("your view is not a BaseView!");
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        mScene = new Scene(viewTuple.getRoot());
//        mScene.getStylesheets().setAll(TestinStage.getInstance().getStylesheet());
        mStage.setScene(mScene);
        mStage.setTitle(view.getTitle());
        return this;
    }
 
开发者ID:cmlanche,项目名称:javafx-qiniu-tinypng-client,代码行数:29,代码来源:BaseDialog.java

示例14: getInstallDir

import javafx.stage.Stage; //导入方法依赖的package包/类
public static void getInstallDir(Predicate<File> predicate) throws IOException {
	ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
	URL fxmlUrl = classLoader.getResource("gui/install_location.fxml");
	if (fxmlUrl == null) {
		OneClientLogging.logger.error("An error has occurred loading the fxml!");
	}
	FXMLLoader fxmlLoader = new FXMLLoader();
	fxmlLoader.setLocation(fxmlUrl);
	fxmlLoader.setBuilderFactory(new JavaFXBuilderFactory());
	Parent root = fxmlLoader.load(fxmlUrl.openStream());
	Stage stage = new Stage();
	stage.setTitle("Select Install Location");
	stage.getIcons().add(new Image("images/icon.png"));
	stage.setResizable(false);
	stage.initOwner(Main.stage);
	stage.initModality(Modality.WINDOW_MODAL);
	Scene scene = new Scene(root, 500, 150);
	scene.getStylesheets().add("gui/css/theme.css");
	stage.setScene(scene);
	stage.show();
	InstallLocation controller = fxmlLoader.getController();
	controller.okButton.setOnAction(event -> {
		predicate.test(new File(controller.locationField.getText()));
		stage.close();
	});
	controller.browseButton.setOnAction(event -> {
		DirectoryChooser directoryChooser = new DirectoryChooser();
		File dir = new File(controller.locationField.getText());
		if (dir.exists())
			directoryChooser.setInitialDirectory(dir);
		File selectedDirectory = directoryChooser.showDialog(stage);
		if (selectedDirectory != null) {
			controller.locationField.setText(selectedDirectory.getAbsolutePath());
		}
	});
	controller.locationField.setText(Constants.getDefaultDir().getAbsolutePath());
}
 
开发者ID:HearthProject,项目名称:OneClient,代码行数:38,代码来源:InstallLocation.java

示例15: showOptionsMenu

import javafx.stage.Stage; //导入方法依赖的package包/类
@Override
public void showOptionsMenu()
{
	List<Submittable> submittables = new ArrayList<>();
	Map<OptionSection, Pane> optionsMenuModel = createOptionsMenuModel(submittables);
	
	OptionsPane optionsPane = new OptionsPane(optionsMenuModel);
	Scene popupScene = new Scene(optionsPane);
	
	Stage popupWindow = new Stage(StageStyle.DECORATED);
	popupWindow.setTitle("Settings");
	popupWindow.initModality(Modality.WINDOW_MODAL);
	popupWindow.initOwner(stage);
	popupWindow.setScene(popupScene);
	
	popupWindow.setMinWidth(stage.getScene().getWidth() / 2);
	popupWindow.setMinHeight(stage.getScene().getHeight()
			- (stage.getScene().getHeight() / 3));
	
	popupScene.getStylesheets().addAll(stage.getScene().getStylesheets());
	
	optionsPane.setOkAction(() -> {
		if (optionsMenuOkSelected(submittables))
		{
			submittables.forEach(submittable -> submittable.submit());
			popupWindow.close();
		}
	});
	optionsPane.setCancelAction(() -> {
		popupWindow.close();
	});
	
	popupWindow.setOnCloseRequest((windowEvent) -> {
		popupWindow.close();
	});
	popupWindow.show();
}
 
开发者ID:dhawal9035,项目名称:WebPLP,代码行数:38,代码来源:Main.java


注:本文中的javafx.stage.Stage.initOwner方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。