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


Java DialogPane.setContent方法代码示例

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


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

示例1: showAbout

import javafx.scene.control.DialogPane; //导入方法依赖的package包/类
@FXML
private void showAbout() throws IOException {
    if (aboutDialog == null) {
        aboutDialog = new Alert(INFORMATION);
        aboutDialog.initOwner(dandelion.getPrimaryStage());
        aboutDialog.initStyle(StageStyle.UTILITY);

        aboutDialog.setTitle("About " + NAME);
        aboutDialog.setHeaderText(NAME + ' ' + VERSION);

        FXMLLoader loader = new FXMLLoader(ClassLoader.getSystemResource("fxml/about.fxml"));
        Node content = loader.load();

        DialogPane pane = aboutDialog.getDialogPane();
        pane.getStyleClass().add("about");
        pane.getStylesheets().add("css/dandelion.css");

        pane.setContent(content);
    }

    aboutDialog.showAndWait();
}
 
开发者ID:Minecrell,项目名称:dandelion,代码行数:23,代码来源:MainController.java

示例2: show

import javafx.scene.control.DialogPane; //导入方法依赖的package包/类
/**
 * Constructs and displays dialog based on the FXML at the specified URL
 * 
 * @param url
 *            the location of the FXML file, relative to the
 *            {@code sic.nmsu.javafx} package
 * @param stateInit
 *            a consumer used to configure the controller before FXML injection
 * @return
 */
public static <R, C extends FXDialogController<R>> R show(String url, Consumer<C> stateInit) {
	final Pair<Parent, C> result = FXController.get(url, stateInit);
	final Parent view = result.getValue0();
	final C ctrl = result.getValue1();

	final Dialog<R> dialog = new Dialog<>();
	dialog.titleProperty().bind(ctrl.title);

	final DialogPane dialogPane = dialog.getDialogPane();
	dialogPane.setContent(view);
	dialogPane.getButtonTypes().add(ButtonType.CLOSE);

	final Stage window = (Stage) dialogPane.getScene().getWindow();
	window.getIcons().add(new Image("images/recipe_icon.png"));

	final Node closeButton = dialogPane.lookupButton(ButtonType.CLOSE);
	closeButton.managedProperty().bind(closeButton.visibleProperty());
	closeButton.setVisible(false);

	ctrl.dialog = dialog;
	ctrl.dialog.showAndWait();

	return ctrl.result;
}
 
开发者ID:NMSU-SIC-Club,项目名称:JavaFX_Tutorial,代码行数:35,代码来源:FXDialogController.java

示例3: initComponents

import javafx.scene.control.DialogPane; //导入方法依赖的package包/类
private void initComponents() {		
	window.setTitle(WINDOW_TITLE);		
	window.setResizable(true);
	
	final DialogPane windowPane = window.getDialogPane(); 
	windowPane.getButtonTypes().addAll(ButtonType.OK, ButtonType.CANCEL);
	
	final Button okButton = (Button)windowPane.lookupButton(ButtonType.OK);
	trackerInputArea.textProperty().addListener((obs, oldV, newV) -> okButton.setDisable(newV.isEmpty()));
	
	final ScrollPane inputAreaScroll = new ScrollPane(trackerInputArea);		
	inputAreaScroll.setFitToHeight(true);
	inputAreaScroll.setFitToWidth(true);
	
	final TitledBorderPane titledTrackerPane = new TitledBorderPane("List of trackers to add",
			inputAreaScroll, BorderStyle.COMPACT, TitledBorderPane.PRIMARY_BORDER_COLOR_STYLE);
	
	final Pane trackerInputPane = new Pane(titledTrackerPane);		
	titledTrackerPane.prefWidthProperty().bind(trackerInputPane.widthProperty());
	titledTrackerPane.prefHeightProperty().bind(trackerInputPane.heightProperty());
	
	windowPane.setContent(trackerInputPane);
}
 
开发者ID:veroslav,项目名称:jfx-torrent,代码行数:24,代码来源:AddTrackerWindow.java

示例4: showDuplicateWarning

import javafx.scene.control.DialogPane; //导入方法依赖的package包/类
public static void showDuplicateWarning(List<String> duplicatePaths, Path lib) {
    Alert alert = new Alert(Alert.AlertType.WARNING);

    DialogPane dialogPane = alert.getDialogPane();

    ListView listView = new ListView();
    listView.getStyleClass().clear();
    ObservableList items = listView.getItems();
    items.addAll(duplicatePaths);
    listView.setEditable(false);

    dialogPane.setContent(listView);

    alert.setTitle("Duplicate JARs found");
    alert.setHeaderText(String.format("Duplicate JARs found, it may cause unexpected behaviours.\n\n" +
            "Please remove the older versions from these pair(s) manually. \n" +
            "JAR files are located at %s directory.", lib));
    alert.getButtonTypes().clear();
    alert.getButtonTypes().addAll(ButtonType.OK);
    alert.showAndWait();
}
 
开发者ID:asciidocfx,项目名称:AsciidocFX,代码行数:22,代码来源:AlertHelper.java

示例5: showAbout

import javafx.scene.control.DialogPane; //导入方法依赖的package包/类
public void showAbout(){
    //root.getStylesheets().add("/styles/Styles.css");
    DialogPane p = new DialogPane();
    p.getStylesheets().add("/styles/Styles.css");
    p.setContent(root);
    this.setDialogPane(p);
    this.setTitle("About");
    this.setResizable(false);
    
    p.getButtonTypes().add(ButtonType.OK);
    this.initModality(Modality.APPLICATION_MODAL);
    this.initStyle(StageStyle.UNIFIED);
    this.show(); 
}
 
开发者ID:Obsidiam,项目名称:amelia,代码行数:15,代码来源:AboutFormController.java

示例6: OptionsDialog

import javafx.scene.control.DialogPane; //导入方法依赖的package包/类
public OptionsDialog(Window owner) {
	setTitle(Messages.get("OptionsDialog.title"));
	initOwner(owner);

	initComponents();

	tabPane.getStyleClass().add(TabPane.STYLE_CLASS_FLOATING);

	DialogPane dialogPane = getDialogPane();
	dialogPane.setContent(tabPane);
	dialogPane.getButtonTypes().addAll(ButtonType.OK, ButtonType.CANCEL);

	// save options on OK clicked
	dialogPane.lookupButton(ButtonType.OK).addEventHandler(ActionEvent.ACTION, e -> {
		save();
		e.consume();
	});

	Utils.fixSpaceAfterDeadKey(dialogPane.getScene());

	// load options
	load();

	// select last tab
	int tabIndex = MarkdownWriterFXApp.getState().getInt("lastOptionsTab", -1);
	if (tabIndex > 0 && tabIndex < tabPane.getTabs().size())
		tabPane.getSelectionModel().select(tabIndex);

	// remember last selected tab
	setOnHidden(e -> {
		MarkdownWriterFXApp.getState().putInt("lastOptionsTab", tabPane.getSelectionModel().getSelectedIndex());
	});
}
 
开发者ID:JFormDesigner,项目名称:markdown-writer-fx,代码行数:34,代码来源:OptionsDialog.java

示例7: LinkDialog

import javafx.scene.control.DialogPane; //导入方法依赖的package包/类
public LinkDialog(Window owner, Path basePath) {
	setTitle(Messages.get("LinkDialog.title"));
	initOwner(owner);
	setResizable(true);

	initComponents();

	linkBrowseDirectoyButton.setBasePath(basePath);
	linkBrowseDirectoyButton.urlProperty().bindBidirectional(urlField.escapedTextProperty());

	linkBrowseFileButton.setBasePath(basePath);
	linkBrowseFileButton.urlProperty().bindBidirectional(urlField.escapedTextProperty());

	DialogPane dialogPane = getDialogPane();
	dialogPane.setContent(pane);
	dialogPane.getButtonTypes().addAll(ButtonType.OK, ButtonType.CANCEL);

	dialogPane.lookupButton(ButtonType.OK).disableProperty().bind(
			urlField.escapedTextProperty().isEmpty());

	Utils.fixSpaceAfterDeadKey(dialogPane.getScene());

	link.bind(Bindings.when(titleField.escapedTextProperty().isNotEmpty())
			.then(Bindings.format("[%s](%s \"%s\")", textField.escapedTextProperty(), urlField.escapedTextProperty(), titleField.escapedTextProperty()))
			.otherwise(Bindings.when(textField.escapedTextProperty().isNotEmpty())
					.then(Bindings.format("[%s](%s)", textField.escapedTextProperty(), urlField.escapedTextProperty()))
					.otherwise(Bindings.format("<%s>", urlField.escapedTextProperty()))));
	previewField.textProperty().bind(link);

	setResultConverter(dialogButton -> {
		return (dialogButton == ButtonType.OK) ? link.get() : null;
	});

	Platform.runLater(() -> {
		urlField.requestFocus();

		if (urlField.getText().startsWith("http://"))
			urlField.selectRange("http://".length(), urlField.getLength());
	});
}
 
开发者ID:JFormDesigner,项目名称:markdown-writer-fx,代码行数:41,代码来源:LinkDialog.java

示例8: ImageDialog

import javafx.scene.control.DialogPane; //导入方法依赖的package包/类
public ImageDialog(Window owner, Path basePath) {
	setTitle(Messages.get("ImageDialog.title"));
	initOwner(owner);
	setResizable(true);

	initComponents();

	linkBrowseFileButton.setBasePath(basePath);
	linkBrowseFileButton.addExtensionFilter(new ExtensionFilter(Messages.get("ImageDialog.chooser.imagesFilter"), "*.png", "*.gif", "*.jpg", "*.svg"));
	linkBrowseFileButton.urlProperty().bindBidirectional(urlField.escapedTextProperty());

	DialogPane dialogPane = getDialogPane();
	dialogPane.setContent(pane);
	dialogPane.getButtonTypes().addAll(ButtonType.OK, ButtonType.CANCEL);

	dialogPane.lookupButton(ButtonType.OK).disableProperty().bind(
			urlField.escapedTextProperty().isEmpty()
				.or(textField.escapedTextProperty().isEmpty()));

	Utils.fixSpaceAfterDeadKey(dialogPane.getScene());

	image.bind(Bindings.when(titleField.escapedTextProperty().isNotEmpty())
			.then(Bindings.format("![%s](%s \"%s\")", textField.escapedTextProperty(), urlField.escapedTextProperty(), titleField.escapedTextProperty()))
			.otherwise(Bindings.format("![%s](%s)", textField.escapedTextProperty(), urlField.escapedTextProperty())));
	previewField.textProperty().bind(image);

	setResultConverter(dialogButton -> {
		return (dialogButton == ButtonType.OK) ? image.get() : null;
	});

	Platform.runLater(() -> {
		urlField.requestFocus();

		if (urlField.getText().startsWith("http://"))
			urlField.selectRange("http://".length(), urlField.getLength());
	});
}
 
开发者ID:JFormDesigner,项目名称:markdown-writer-fx,代码行数:38,代码来源:ImageDialog.java

示例9: DicomSendDialog

import javafx.scene.control.DialogPane; //导入方法依赖的package包/类
public DicomSendDialog() {
    _dlg = new Dialog<Void>();
    DialogPane dp = _dlg.getDialogPane();
    dp.setContent(new StackPane(new Text("test content")));
    dp.setMinSize(600, 380);
    dp.getButtonTypes().add(ButtonType.CANCEL);
    dp.getButtonTypes().add(ButtonType.OK);
    
    _dlg.setWidth(600);
    _dlg.setHeight(400);
    _dlg.show();
}
 
开发者ID:uom-daris,项目名称:daris,代码行数:13,代码来源:DicomSendDialog.java

示例10: ProjectSettingsEditor

import javafx.scene.control.DialogPane; //导入方法依赖的package包/类
@SuppressWarnings("JavadocMethod")
public ProjectSettingsEditor(Parent root,
                             ProjectSettings projectSettings,
                             AppSettings appSettings) {
  super();

  VBox content = new VBox(
      new CustomPropertySheet(BeanPropertyUtils.getProperties(projectSettings)),
      new Separator(),
      new CustomPropertySheet(BeanPropertyUtils.getProperties(appSettings))
  );
  content.setSpacing(5.0);

  DialogPane pane = getDialogPane();
  pane.getButtonTypes().setAll(ButtonType.OK, ButtonType.CANCEL);
  pane.setContent(content);
  pane.styleProperty().bind(root.styleProperty());
  pane.getStylesheets().addAll(root.getStylesheets());
  pane.setPrefSize(DPIUtility.SETTINGS_DIALOG_SIZE, DPIUtility.SETTINGS_DIALOG_SIZE);

  ImageView graphic = new ImageView(
      new Image(getClass().getResourceAsStream("icons/settings.png")));
  graphic.setFitWidth(DPIUtility.SMALL_ICON_SIZE);
  graphic.setFitHeight(DPIUtility.SMALL_ICON_SIZE);

  setTitle("Settings");
  setHeaderText("Settings");
  setGraphic(graphic);
  setResizable(true);
}
 
开发者ID:WPIRoboticsProjects,项目名称:GRIP,代码行数:31,代码来源:ProjectSettingsEditor.java

示例11: JFXAlert

import javafx.scene.control.DialogPane; //导入方法依赖的package包/类
public JFXAlert(Stage stage) {
    // set the stage to transparent
    initStyle(StageStyle.TRANSPARENT);
    initOwner(stage);

    // create custom dialog pane
    setDialogPane(new DialogPane() {
        {
            getButtonTypes().add(ButtonType.CLOSE);
            Node closeButton = this.lookupButton(ButtonType.CLOSE);
            closeButton.managedProperty().bind(closeButton.visibleProperty());
            closeButton.setVisible(false);
        }
        @Override
        protected Node createButtonBar() {
            return null;
        }
    });


    // init style for the content container
    contentContainer = new StackPane();
    contentContainer.getStyleClass().add("jfx-alert-content-container");

    // set dialog pane content
    final Node materialNode = JFXDepthManager.createMaterialNode(contentContainer, 2);
    materialNode.setPickOnBounds(false);
    materialNode.addEventHandler(MouseEvent.MOUSE_CLICKED, event->event.consume());

    // init style for overlay
    overlay = new StackPane(materialNode){
        public String getUserAgentStylesheet() {
            return getClass().getResource("/css/controls/jfx-alert.css").toExternalForm();
        }
    };
    overlay.getStyleClass().add("jfx-alert-overlay");

    // customize dialogPane
    final DialogPane dialogPane = getDialogPane();
    dialogPane.getScene().setFill(Color.TRANSPARENT);
    dialogPane.setStyle("-fx-background-color: transparent;");
    dialogPane.prefWidthProperty().bind(stage.getScene().widthProperty());
    dialogPane.prefHeightProperty().bind(stage.getScene().heightProperty());
    dialogPane.setContent(overlay);

    updateX(stage, dialogPane);
    updateY(stage, dialogPane);

    // bind dialog position to stage position
    stage.getScene().widthProperty().addListener(observable -> updateSize(dialogPane));
    stage.getScene().heightProperty().addListener(observable -> updateSize(dialogPane));
    stage.xProperty().addListener((observable, oldValue, newValue) -> updateX(stage, dialogPane));
    stage.yProperty().addListener((observable, oldValue, newValue) -> updateY(stage, dialogPane));

    // handle animation
    eventHandlerManager.addEventHandler(DialogEvent.DIALOG_SHOWING, event -> {
        if (getAnimation() != null) {
            getAnimation().initAnimation(contentContainer.getParent(), overlay);
        }
    });
    eventHandlerManager.addEventHandler(DialogEvent.DIALOG_SHOWN, event -> {
        if (getAnimation() != null) {
            Animation animation = getAnimation().createShowingAnimation(contentContainer.getParent(), overlay);
            if (animation != null) {
                animation.play();
            }
        }
    });
    overlay.addEventHandler(MouseEvent.MOUSE_CLICKED, event -> {
        if (this.isOverlayClose()) {
            new Thread(() -> hideWithAnimation()).start();
        }
    });
}
 
开发者ID:jfoenixadmin,项目名称:JFoenix,代码行数:75,代码来源:JFXAlert.java

示例12: ProjectionSelectionDialog

import javafx.scene.control.DialogPane; //导入方法依赖的package包/类
public ProjectionSelectionDialog() {
	projMap = new HashMap<TreeItem<String>, Projection>();
	
	final TreeItem<String> root = new TreeItem<String>();
	menu = new TreeView<String>(root);
	menu.setShowRoot(false); //create and configure the TreeView of options
	menu.setPrefWidth(MENU_WIDTH);
	
	flow = new TextFlow(); //create and configure the description area
	flow.setPrefWidth(TEXT_WIDTH);
	text = new GridPane();
	text.setHgap(10);
	
	menu.getSelectionModel().selectedItemProperty().addListener((observable, old, now) -> {
			if (projMap.containsKey(now)) //selection callback to describe each projection
				describe(projMap.get(now));
			else if (now != null) {
				describe(null);
			}
		});
	menu.setCellFactory((tView) -> { //factoring cells to detect double-clicks
			final TreeCell<String> cell = new TextFieldTreeCell<String>();
			cell.setOnMouseClicked((event) -> { //on double click, close dialog
					if (event.getClickCount() >= 2 && projMap.containsKey(cell.getTreeItem())) {
						this.setResult(projMap.get(cell.getTreeItem()));
					}
				});
			return cell;
		});
	
	String[] categories = MapApplication.PROJECTION_CATEGORIES;
	Projection[][] projections = MapApplication.ALL_PROJECTIONS;
	for (int i = 0; i < categories.length; i ++) { //finally, populate the TreeView
		final TreeItem<String> header = new TreeItem<String>(categories[i]);
		root.getChildren().add(header);
		for (int j = 0; j < projections[i].length; j ++) {
			final TreeItem<String> leaf = new TreeItem<String>(projections[i][j].getName());
			projMap.put(leaf, projections[i][j]);
			header.getChildren().add(leaf);
		}
	}
	
	this.setTitle("Projection selection"); //set general properties for the dialog
	final DialogPane pane = this.getDialogPane();
	pane.setHeaderText("Choose a projection from the list below.");
	pane.getButtonTypes().addAll(new ButtonType[] { ButtonType.OK, ButtonType.CANCEL }); //add buttons
	pane.setContent(new HBox(10, menu, new VBox(10, flow, text)));
	
	this.setResultConverter((btn) -> { //how to return a result:
			if (btn != null && btn.getButtonData() == ButtonData.OK_DONE) {
				final TreeItem<String> selection =  menu.getSelectionModel().getSelectedItem();
				return projMap.getOrDefault(selection, Projection.NULL_PROJECTION); //return the corresponding projection
			} //or NULL_PROJECTION if the user never chose anything
			else {
				return null;
			}
		});
}
 
开发者ID:jkunimune15,项目名称:Map-Projections,代码行数:59,代码来源:ProjectionSelectionDialog.java

示例13: buildDeleteAlertDialog

import javafx.scene.control.DialogPane; //导入方法依赖的package包/类
static Alert buildDeleteAlertDialog(List<Path> pathsLabel) {
  	Alert deleteAlert = new Alert(Alert.AlertType.WARNING, null, ButtonType.YES, ButtonType.CANCEL);
      deleteAlert.setHeaderText("Do you want to delete selected path(s)?");
      DialogPane dialogPane = deleteAlert.getDialogPane();
              
      ObservableList<Path> paths = Optional.ofNullable(pathsLabel)
      		.map(FXCollections::observableList)
      		.orElse(FXCollections.emptyObservableList());
      
      if (paths.isEmpty()) {
      	dialogPane.setContentText("There are no files selected.");
      	deleteAlert.getButtonTypes().clear();
      	deleteAlert.getButtonTypes().add(ButtonType.CANCEL);
      	return deleteAlert;
      } 
      
      ListView<Path> listView = new ListView<>(paths);
      listView.setId("listOfPaths");
      
      GridPane gridPane = new GridPane();
      gridPane.addRow(0, listView);
      GridPane.setHgrow(listView, Priority.ALWAYS);
      
double minWidth = 200.0;
double maxWidth = Screen.getScreens().stream()
		.mapToDouble(s -> s.getBounds().getWidth()/3)
		.min().orElse(minWidth);

double prefWidth = paths.stream()
 			.map(String::valueOf)
 			.mapToDouble(s->s.length() * 7)
 			.max()
 			.orElse(maxWidth);
      
double minHeight = IntStream.of(paths.size())
	.map(e -> e * 70)
	.filter(e -> e <= 300 && e >= 70)
	.findFirst()
	.orElse(200);

gridPane.setMinWidth(minWidth);
gridPane.setPrefWidth(prefWidth);
gridPane.setPrefHeight(minHeight);
dialogPane.setContent(gridPane);
return deleteAlert;
  }
 
开发者ID:asciidocfx,项目名称:AsciidocFX,代码行数:47,代码来源:AlertHelper.java


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