本文整理汇总了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();
});
}
示例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();
}
示例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) {
}
}
示例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);
}
}
示例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();
}
示例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();
}
}
示例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();
}
示例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();
}
}
示例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());
}
示例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);
}
}
示例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);
}
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}