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


Java Modality类代码示例

本文整理汇总了Java中javafx.stage.Modality的典型用法代码示例。如果您正苦于以下问题:Java Modality类的具体用法?Java Modality怎么用?Java Modality使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: handleAddNewDrug

import javafx.stage.Modality; //导入依赖的package包/类
@FXML
private void handleAddNewDrug(ActionEvent event) throws IOException {
    FXMLLoader fXMLLoader = new FXMLLoader();
    fXMLLoader.setLocation(getClass().getResource("/view/drug/NewDrug.fxml"));
    Stage stage = new Stage();
    Scene scene = new Scene(fXMLLoader.load());
    stage.setScene(scene);
    stage.initModality(Modality.APPLICATION_MODAL);
    stage.setTitle("New Drug");
    stage.show();

    stage.setOnCloseRequest((WindowEvent event1) -> {
        drugs.clear();
        loadDrug();
    });
}
 
开发者ID:kmrifat,项目名称:Dr-Assistant,代码行数:17,代码来源:NewPrescriptionController.java

示例2: addTransition

import javafx.stage.Modality; //导入依赖的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();
}
 
开发者ID:leeks-and-dragons,项目名称:dialog-tool,代码行数:27,代码来源:TransitionPaneController.java

示例3: AlertBox

import javafx.stage.Modality; //导入依赖的package包/类
public AlertBox(Stage primaryStage, FXMLLoader fxmlLoader, boolean alertType, String msg) {
    try {
        Parent root = (Parent) fxmlLoader.load();
        Scene scene = new Scene(root);
        Label alertText = (Label) scene.lookup("#alert_text");
        alertText.setText(msg);
        if (alertType == true)
            alertText.setStyle("-fx-text-fill: chartreuse");
        else
            alertText.setStyle("-fx-text-fill: red");
        Stage stage = new Stage();
        stage.setResizable(false);
        stage.initModality(Modality.WINDOW_MODAL);
        stage.initOwner(primaryStage);
        stage.initStyle(StageStyle.UNDECORATED);
        stage.setScene(scene);
        stage.showAndWait();
    } catch (Exception e) {
    }
}
 
开发者ID:alchemsynergy,项目名称:alchem,代码行数:21,代码来源:AlertBox.java

示例4: showAndWait

import javafx.stage.Modality; //导入依赖的package包/类
public static void showAndWait(String url, 
        Predicate<WebEngine> loginSuccessTest,
        Consumer<WebEngine> handler) {
    try {
        FXMLLoader loader = new FXMLLoader(LoginController.class.getResource("/fxml/login.fxml"));

        Stage stage = new Stage();
        stage.setScene(new Scene(loader.load()));
        LoginController controller = loader.<LoginController>getController();
        controller.setUrl(url);
        controller.setLoginSuccessTest(loginSuccessTest);
        controller.setHandler(handler);

        stage.setTitle("Login...");
        stage.initModality(Modality.APPLICATION_MODAL);

        stage.showAndWait();
    } catch (IOException ex) {
        throw new RuntimeException(ex);
    }
}
 
开发者ID:PacktPublishing,项目名称:Java-9-Programming-Blueprints,代码行数:22,代码来源:LoginController.java

示例5: studyProfileDetails

import javafx.stage.Modality; //导入依赖的package包/类
/**
 * Displays the StudyProfile details page
 *
 * @param profile StudyProfile for which the details should be shown.
 */
public void studyProfileDetails(StudyProfile profile) throws IOException
{
    StudyProfileController spc = new StudyProfileController(profile);

    // Load in the .fxml file:
    FXMLLoader loader = new FXMLLoader(getClass().getResource("/View/StudyProfile.fxml"));
    loader.setController(spc);
    Parent root = loader.load();

    // Set the scene:
    Stage stage = new Stage();
    stage.initModality(Modality.APPLICATION_MODAL);
    stage.setScene(new Scene(root, 550, 232));
    stage.setTitle(profile.getName());
    stage.resizableProperty().setValue(false);
    stage.getIcons().add(new Image("file:icon.png"));
    stage.showAndWait();
}
 
开发者ID:Alienturnedhuman,项目名称:PearPlanner,代码行数:24,代码来源:UIManager.java

示例6: createDatabaseItemModificationStage

import javafx.stage.Modality; //导入依赖的package包/类
/**
 * Creates a new JavaFX stage for adding/editing/deleting a {@link DatabaseItem}
 *
 * @param viewPath      the path to the xml file representing the view
 * @param stageTitle    the title to be shown at the top of the stage
 */
private void createDatabaseItemModificationStage(String viewPath, String stageTitle) {
    try {
        FXMLLoader loader = new FXMLLoader(getClass().getResource(viewPath));
        Stage newStage = new Stage();
        newStage.setTitle(stageTitle);
        newStage.setScene(new Scene(loader.load()));
        DatabaseItemModificationController databaseItemModificationController = loader.getController();
        databaseItemModificationController.setNewLogEntryTabController(this);
        databaseItemModificationController.setStage(newStage);
        newStage.initModality(Modality.APPLICATION_MODAL);
        newStage.show();
    } catch (IOException e) {
        createErrorStage();
        e.printStackTrace();
    }
}
 
开发者ID:kwilliams3,项目名称:Recordian,代码行数:23,代码来源:NewLogEntryTabController.java

示例7: onEditPriceClickedButton

import javafx.stage.Modality; //导入依赖的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

示例8: showNoticeDialog

import javafx.stage.Modality; //导入依赖的package包/类
@FXML
public void showNoticeDialog() {
	
	try {

		FXMLLoader loader = new FXMLLoader(Main.class.getResource("views/Notice.fxml"));
		StackPane page = (StackPane) loader.load();

		Stage dialog = new Stage();
		Scene scene = new Scene(page);
		dialog.getIcons().add(new Image("file:wdm.png"));
		dialog.setTitle("공지사항");
		dialog.initModality(Modality.WINDOW_MODAL);
		dialog.setResizable(false);
		dialog.setScene(scene);
		dialog.setAlwaysOnTop(true);
		dialog.show();

	} catch (Exception e) {
		e.printStackTrace();
	}
	
}
 
开发者ID:kimyearho,项目名称:WebtoonDownloadManager,代码行数:24,代码来源:MainController.java

示例9: alwaysInTop

import javafx.stage.Modality; //导入依赖的package包/类
public static void alwaysInTop(Alert alert) {
        try{
            DialogPane root = alert.getDialogPane();

            Stage dialogStage = new Stage(StageStyle.UTILITY);

            for (ButtonType buttonType : root.getButtonTypes()) {
                ButtonBase button = (ButtonBase) root.lookupButton(buttonType);
                button.setOnAction(evt -> {
                    root.setUserData(buttonType);
                    dialogStage.close();
                });
            }

            root.getScene().setRoot(new Group());

            Scene scene = new Scene(root);

            dialogStage.setScene(scene);
            dialogStage.initModality(Modality.APPLICATION_MODAL);
            dialogStage.setAlwaysOnTop(true);
            dialogStage.setResizable(false);
            dialogStage.showAndWait();
        }catch(Exception e){
            
        }
//        Optional<ButtonType> result = Optional.ofNullable((ButtonType) root.getUserData());
    }
 
开发者ID:mhusam,项目名称:ChessBot,代码行数:29,代码来源:UIUtils.java

示例10: showPackageDiff

import javafx.stage.Modality; //导入依赖的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

示例11: editDrug

import javafx.stage.Modality; //导入依赖的package包/类
private void editDrug(Drug drug) {
    FXMLLoader fXMLLoader = new FXMLLoader(getClass().getResource("/view/drug/EditDrug.fxml"));
    try {
        Parent root = fXMLLoader.load();
        EditDrugController controller = fXMLLoader.getController();
        controller.setDrugId(drug.getId());
        controller.taNote.setText(drug.getNote());
        controller.tfTradeName.setText(drug.getName());
        controller.tfGenericName.setText(drug.getGenricName());
        Stage stage = new Stage();
        stage.initModality(Modality.APPLICATION_MODAL);
        stage.setTitle("Edit Drug");
        stage.setScene(new Scene(root));
        stage.show();

    } catch (IOException ex) {
        Logger.getLogger(PatientsController.class.getName()).log(Level.SEVERE, null, ex);
    }
}
 
开发者ID:kmrifat,项目名称:Dr-Assistant,代码行数:20,代码来源:DrugsController.java

示例12: start

import javafx.stage.Modality; //导入依赖的package包/类
public void start() {
    stage = new Stage();
    stage.initModality(Modality.APPLICATION_MODAL);
    stage.setTitle("Rename File");
    stage.setWidth(400);
    stage.setHeight(150);
    stage.setResizable(false);

    Screen screen = new Screen();
    Point point = screen.calculateCenter(400, 150);
    stage.setX(point.getX());
    stage.setY(point.getY());

    CustomIcons customIcons = new CustomIcons();
    stage.getIcons().add(customIcons.getLogo());

    RenameFolderView renameFolderView = new RenameFolderView();
    Scene scene = new Scene(renameFolderView.getView());
    stage.setScene(scene);
    stage.show();
}
 
开发者ID:MrChebik,项目名称:Coconut-IDE,代码行数:22,代码来源:RenameFolderPlace.java

示例13: onResetEmployeePasswordButtonClicked

import javafx.stage.Modality; //导入依赖的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

示例14: milestoneDetails

import javafx.stage.Modality; //导入依赖的package包/类
/**
 * Displays the Milestone details page
 *
 * @param milestone Milestone for which the details should be shown.
 */
public void milestoneDetails(Milestone milestone) throws IOException
{
    MilestoneController mc = new MilestoneController(milestone);

    // Load in the .fxml file:
    FXMLLoader loader = new FXMLLoader(getClass().getResource("/View/Milestone.fxml"));
    loader.setController(mc);
    Parent root = loader.load();

    // Set the scene:
    Stage stage = new Stage();
    stage.initModality(Modality.APPLICATION_MODAL);
    stage.setScene(new Scene(root, 550, 355));
    stage.setTitle("Milestone");
    stage.resizableProperty().setValue(false);
    stage.getIcons().add(new Image("file:icon.png"));
    stage.showAndWait();
}
 
开发者ID:Alienturnedhuman,项目名称:PearPlanner,代码行数:24,代码来源:UIManager.java

示例15: start

import javafx.stage.Modality; //导入依赖的package包/类
public void start() {
    stage = new Stage();
    stage.initModality(Modality.APPLICATION_MODAL);
    stage.setTitle("Create Folder");
    stage.setWidth(400);
    stage.setHeight(150);
    stage.setResizable(false);

    Screen screen = new Screen();
    Point point = screen.calculateCenter(400, 150);
    stage.setX(point.getX());
    stage.setY(point.getY());

    CustomIcons customIcons = new CustomIcons();
    stage.getIcons().add(customIcons.getLogo());

    CreateFolderView createFolderView = new CreateFolderView();
    Scene scene = new Scene(createFolderView.getView());
    stage.setScene(scene);
    stage.show();
}
 
开发者ID:MrChebik,项目名称:Coconut-IDE,代码行数:22,代码来源:CreateFolderPlace.java


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