當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。