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


Java Dialog.setContentText方法代码示例

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


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

示例1: init

import javafx.scene.control.Dialog; //导入方法依赖的package包/类
protected void init() {

        String tooltip = toolBox.getI18nBundle().getString("buttons.upon");
        MaterialIconFactory iconFactory = MaterialIconFactory.get();
        Text icon = iconFactory.createIcon(MaterialIcon.VERTICAL_ALIGN_BOTTOM, "30px");
        Text icon2 = iconFactory.createIcon(MaterialIcon.VERTICAL_ALIGN_BOTTOM, "30px");
        initializeButton(tooltip, icon);

        ResourceBundle i18n = toolBox.getI18nBundle();
        Dialog<String> dialog = dialogController.getDialog();
        dialog.setTitle(i18n.getString("buttons.upon.dialog.title"));
        dialog.setHeaderText(i18n.getString("buttons.upon.dialog.header"));
        dialog.setContentText(i18n.getString("buttons.upon.dialog.content"));
        dialog.setGraphic(icon2);
        dialog.getDialogPane().getStylesheets().addAll(toolBox.getStylesheets());

    }
 
开发者ID:mbari-media-management,项目名称:vars-annotation,代码行数:18,代码来源:UponBC.java

示例2: prepareDialog

import javafx.scene.control.Dialog; //导入方法依赖的package包/类
/**
 * Initialize a dialog by setting its title, header and content
 * and set window style to "utility dialog".
 *
 * @param dialog The dialog to initialize
 * @param keyTitle Key for dialog title in the translation file
 * @param keyHeader Key for dialog header in the translation file
 * @param keyContent Key for dialog content in the translation file
 * @param windowData The position and size of the parent window
 */
protected static void prepareDialog(final Dialog dialog, final String keyTitle,
        final String keyHeader, final String keyContent, final ParentWindowData windowData) {
    dialog.setTitle(TRANSLATIONS.getString(keyTitle));
    dialog.setHeaderText(TRANSLATIONS.getString(keyHeader));
    dialog.setContentText(TRANSLATIONS.getString(keyContent));
    ((Stage) dialog.getDialogPane().getScene().getWindow()).initStyle(StageStyle.UTILITY);
    dialog.setResizable(false);

    /* Handler to place the dialog in the middle of the main window instead of the middle
     * of the screen; the width oh the dialog is fixed. */
    dialog.setOnShown(new EventHandler<DialogEvent>() {
        public void handle(final DialogEvent event) {
            dialog.setWidth(DIALOG_WIDTH);
            dialog.getDialogPane().setMaxWidth(DIALOG_WIDTH);
            dialog.getDialogPane().setMinWidth(DIALOG_WIDTH);
            dialog.setX(windowData.getX() + (windowData.getWidth() / 2) - (dialog.getWidth() / 2));
            dialog.setY(windowData.getY() + 30);
        }
    });
}
 
开发者ID:tortlepp,项目名称:SimpleTaskList,代码行数:31,代码来源:AbstractDialogController.java

示例3: pickStylerToConfigure

import javafx.scene.control.Dialog; //导入方法依赖的package包/类
private void pickStylerToConfigure(final List<Parameterizable> stylers) {
   if (stylers.size() == 1) {
      selectInCombo(stylers.get(0));
      return;
   } else if (stylers.isEmpty()) {
      selectInCombo(null);
      return;
   }
   List<ParameterizableWrapper> pw = new ArrayList<>(stylers.size());
   stylers.stream().forEach((p) -> {
      pw.add(new ParameterizableWrapper(p));
   });
   Dialog<ParameterizableWrapper> dialog = new ChoiceDialog<>(pw.get(0), pw);
   ButtonType bt = new ButtonType("choose", ButtonBar.ButtonData.OK_DONE);
   dialog.getDialogPane().getButtonTypes().clear();
   dialog.getDialogPane().getButtonTypes().add(bt);
   dialog.setTitle("Please choose");
   dialog.setHeaderText(null);
   dialog.setResizable(true);
   dialog.setContentText("choose the styler or condition you want to configure");
   Optional<ParameterizableWrapper> choice = dialog.showAndWait();
   if (choice.isPresent()) {
      selectInCombo(choice.get().p);
   }
}
 
开发者ID:eduarddrenth,项目名称:iText-GUI,代码行数:26,代码来源:Controller.java

示例4: uploadGame

import javafx.scene.control.Dialog; //导入方法依赖的package包/类
@FXML
protected void uploadGame() {
    if (!new File(JGMRConfig.getInstance().getPath() + "/.jgmrlock.lock").exists()) {
        FileChooser directoryChooser = new FileChooser();
        if (JGMRConfig.getInstance().getPath() != null) {
            directoryChooser.setInitialDirectory(new File(JGMRConfig.getInstance().getPath()));
        }
        Stage stage = new Stage();
        File fileResult = directoryChooser.showOpenDialog(stage);
        if (fileResult != null) {
            Alert alert = new Alert(AlertType.CONFIRMATION);
            alert.setTitle("Upload to " + game.getName());
            alert.setHeaderText("Upload to " + game.getName());
            alert.setContentText("Are you sure you wish to upload " + fileResult.getName() + " to the game " + game.getName());
            Optional<ButtonType> result = alert.showAndWait();
            if (result.get() == ButtonType.OK) {
                uploadGame(fileResult);
            }
        }
    } else {
        Dialog dg = new Dialog();
        dg.setContentText("An upload or download is already in progress, please wait for the previous operation to finish.");
        dg.setTitle("Download or Upload already in progress.");
        dg.getDialogPane().getButtonTypes().add(new ButtonType("Ok", ButtonBar.ButtonData.OK_DONE));
        Platform.runLater(() -> {
            dg.showAndWait();
        });
    }
}
 
开发者ID:eternia16,项目名称:javaGMR,代码行数:30,代码来源:GamepaneController.java

示例5: downloadSaveFile

import javafx.scene.control.Dialog; //导入方法依赖的package包/类
/**
 * Downloads the save file from the GMR site.
 *
 * @param selectedItem This parameter is used to download the save file from
 * the site
 */
public void downloadSaveFile(Game selectedItem) throws MalformedURLException, IOException {
    String requestUrl = "http://multiplayerrobot.com/api/Diplomacy/GetLatestSaveFileBytes";
    URL url = new URL(requestUrl + "?authkey=" + JGMRConfig.getInstance().getAuthCode() + "&gameId=" + selectedItem.getGameid());
    HttpURLConnection httpConnection = (HttpURLConnection) (url.openConnection());
    long completeFileSize = httpConnection.getContentLength();
    httpConnection.setReadTimeout(15000);

    File targetFile = new File(JGMRConfig.getInstance().getPath() + "/(jGMR) Play this one.Civ5Save");
    if (!new File(JGMRConfig.getInstance().getPath() + "/.jgmrlock.lock").exists()) {
        File lock = new File(JGMRConfig.getInstance().getPath() + "/.jgmrlock.lock");
        lock.createNewFile();

        java.io.BufferedInputStream is = new java.io.BufferedInputStream(httpConnection.getInputStream());

        try (OutputStream outStream = new FileOutputStream(targetFile)) {
            byte[] buffer = new byte[8 * 1024];
            int bytesRead;
            double downLoadFileSize = 0;
            while ((bytesRead = is.read(buffer)) != -1) {
                downLoadFileSize = downLoadFileSize + bytesRead;
                outStream.write(buffer, 0, bytesRead);
                sendDownloadProgress(((double) downLoadFileSize / (double) completeFileSize));
            }
            JGMRConfig.getInstance().readDirectory();
        }
        lock.delete();
    } else {
        Dialog dg = new Dialog();
        dg.setContentText("An upload or download is already in progress, please wait for the previous operation to finish.");
        dg.setTitle("Download or Upload already in progress.");
        dg.getDialogPane().getButtonTypes().add(new ButtonType("Login", ButtonData.OK_DONE));
        Platform.runLater(() -> {
            dg.showAndWait();
        });

    }

}
 
开发者ID:eternia16,项目名称:javaGMR,代码行数:45,代码来源:GameController.java

示例6: setupDialog

import javafx.scene.control.Dialog; //导入方法依赖的package包/类
private static void setupDialog(Window owner, String title, String headerText, String contentText, Dialog<?> alert) {
	alert.setTitle(title);
	alert.setHeaderText(headerText);
	alert.setContentText(contentText);
	alert.initOwner(owner);
	alert.initModality(Modality.WINDOW_MODAL);
}
 
开发者ID:enoy19,项目名称:keyboard-light-composer,代码行数:8,代码来源:DialogUtil.java

示例7: showMessageDialog

import javafx.scene.control.Dialog; //导入方法依赖的package包/类
public static void showMessageDialog(Window window, String title, String message) {
  Dialog<ButtonType> dialog = createDialog();
  if (window != null) {
    dialog.initOwner(window);
  }
  dialog.getDialogPane().getButtonTypes().addAll(ButtonType.OK);
  dialog.setTitle(title);
  dialog.setContentText(message);
  dialog.showAndWait();
}
 
开发者ID:XDean,项目名称:CSS-Editor-FX,代码行数:11,代码来源:Util.java

示例8: showConfirmDialog

import javafx.scene.control.Dialog; //导入方法依赖的package包/类
public static boolean showConfirmDialog(Window window, String title, String message) {
  Dialog<ButtonType> dialog = createDialog();
  if (window != null) {
    dialog.initOwner(window);
  }
  dialog.getDialogPane().getButtonTypes().addAll(ButtonType.OK, ButtonType.CANCEL);
  dialog.setTitle(title);
  dialog.setContentText(message);
  return dialog.showAndWait().orElse(ButtonType.CANCEL).equals(ButtonType.OK);
}
 
开发者ID:XDean,项目名称:CSS-Editor-FX,代码行数:11,代码来源:Util.java

示例9: showConfirmCancelDialog

import javafx.scene.control.Dialog; //导入方法依赖的package包/类
/**
 * 
 * @param window
 * @param title
 * @param message
 * @return {@code ButtonType.YES, ButtonType.NO, ButtonType.CANCEL}
 */
public static ButtonType showConfirmCancelDialog(Window window, String title, String message) {
  Dialog<ButtonType> dialog = createDialog();
  if (window != null) {
    dialog.initOwner(window);
  }
  dialog.getDialogPane().getButtonTypes().addAll(ButtonType.YES, ButtonType.NO, ButtonType.CANCEL);
  dialog.setTitle(title);
  dialog.setContentText(message);
  return dialog.showAndWait().orElse(ButtonType.CANCEL);
}
 
开发者ID:XDean,项目名称:CSS-Editor-FX,代码行数:18,代码来源:Util.java

示例10: acceptCallDialog

import javafx.scene.control.Dialog; //导入方法依赖的package包/类
public void acceptCallDialog(final Client client) {
    // set current client
    Core.instance().main().showUser(client);
    Core.instance().main().selectVideoCall();

    // create the custom dialog.
    Dialog<Boolean> dialog = new Dialog<>();
    dialog.setTitle("Incoming Call!");
    dialog.setHeaderText(userName.getText());
    dialog.setContentText(userName.getText() + " is calling...\n"
            + "Do you want to accept this call?");

    // set the icon 
    dialog.setGraphic(new ImageView(userPhoto.getImage()));

    // set the button types.
    ButtonType acceptButton = new ButtonType("Accept", ButtonData.OK_DONE);
    ButtonType declineButton = new ButtonType("Decline", ButtonData.CANCEL_CLOSE);
    dialog.getDialogPane().getButtonTypes().addAll(acceptButton, declineButton);

    // define result converter 
    dialog.setResultConverter(dialogButton -> {
        return dialogButton == acceptButton;
    });

    // return the result
    Optional<Boolean> result = dialog.showAndWait();
    if (result.isPresent() && result.get()) {
        Core.instance().dialer().acceptResponse(client, null);
    } else {
        Core.instance().dialer().acceptResponse(client, new Exception("Call was rejected"));
    }
}
 
开发者ID:dipu-bd,项目名称:Tuntuni,代码行数:34,代码来源:VideoCallController.java

示例11: createBasicDialog

import javafx.scene.control.Dialog; //导入方法依赖的package包/类
private Dialog<ButtonType> createBasicDialog(final String title, final String message) {
    Dialog<ButtonType> d = new Dialog<>();
    d.setTitle(title);
    d.setContentText(message);
    d.initModality(Modality.APPLICATION_MODAL);
    d.initStyle(StageStyle.UNDECORATED);
    return d;
}
 
开发者ID:Vogel612,项目名称:TranslationHelper,代码行数:9,代码来源:JFXDialog.java

示例12: handleAbout

import javafx.scene.control.Dialog; //导入方法依赖的package包/类
/**
 * Menu item: Help->About.
 * Shows a short modal about dialog.
 */
@FXML
private void handleAbout() {
    Dialog<Label> dialog = new Dialog<>();
    dialog.setContentText(
            "                               StudyGuide\n" + "    <https://github.com/oskopek/StudyGuide>\n"
                    + messages.getString("menu.author") + ": Ondrej Skopek <[email protected]>");
    dialog.setTitle(messages.getString("root.about"));
    dialog.getDialogPane().getButtonTypes().add(ButtonType.CLOSE);
    dialog.showAndWait();
}
 
开发者ID:oskopek,项目名称:StudyGuide,代码行数:15,代码来源:RootLayoutController.java

示例13: showMessage

import javafx.scene.control.Dialog; //导入方法依赖的package包/类
public static void showMessage(String title, String header, String message, String expandable) {
    Dialog d = new Dialog();
    d.setTitle(title);
    d.setHeaderText(header);
    d.setContentText(message);
    TextArea expanded = new TextArea(expandable);
    expanded.setEditable(false);
    d.getDialogPane().setExpandableContent(new ScrollPane(expanded));
    d.getDialogPane().getButtonTypes().add(ButtonType.OK);
    d.showAndWait();
}
 
开发者ID:jmhertlein,项目名称:mcanalytics,代码行数:12,代码来源:Dialogs.java

示例14: notify

import javafx.scene.control.Dialog; //导入方法依赖的package包/类
public static void notify(String buttonText, String title, String details) {
   Dialog<String> dialog = new Dialog<>();
   dialog.setContentText(addNewLines(details, 120));
   dialog.setTitle(title);
   dialog.setResizable(true);
   ButtonType bt = new ButtonType(buttonText, ButtonBar.ButtonData.OK_DONE);
   dialog.getDialogPane().getButtonTypes().add(bt);
   dialog.showAndWait();
}
 
开发者ID:eduarddrenth,项目名称:iText-GUI,代码行数:10,代码来源:ViewHelper.java

示例15: showConfirmTabDeleteDialog

import javafx.scene.control.Dialog; //导入方法依赖的package包/类
void showConfirmTabDeleteDialog() {
	Dialog<ButtonType> dialog = new Dialog<>();
	dialog.getDialogPane().getButtonTypes().add(new ButtonType("Yes", ButtonData.OK_DONE));
	dialog.getDialogPane().getButtonTypes().add(new ButtonType("Cancel", ButtonData.CANCEL_CLOSE));
	dialog.setContentText("Are you sure you want to delete the current tab?");
	dialog.showAndWait()
		.filter(response -> response.getButtonData() == ButtonType.OK.getButtonData())
		.ifPresent( response -> FXController.instance.removeTimerTab(this.getCurrentTab()));
}
 
开发者ID:Talkarcabbage,项目名称:rs-timer,代码行数:10,代码来源:MainWindow.java


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