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


Java DialogEvent类代码示例

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


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

示例1: TemplateBox

import javafx.scene.control.DialogEvent; //导入依赖的package包/类
public TemplateBox(String name) {
	setTitle(name);
	initModality(Modality.NONE);
	String style = LocalFont.getDefaultFontCSS();
	getDialogPane().setStyle(
			style
	);
	Stage stage = (Stage) getDialogPane().getScene().getWindow();
	stage.setAlwaysOnTop(checkForceOnTop());
	stage.getIcons().add(new Image(App.ICON_URL.toString()));
	getDialogPane().getButtonTypes().add(new ButtonType(Main.getString("close"), ButtonBar.ButtonData.CANCEL_CLOSE));

	openedDialogs.add(this);

	final TemplateBox thisBox = this;
	setOnCloseRequest(new EventHandler<DialogEvent>() {
		@Override
		public void handle(DialogEvent event) {
			openedDialogs.remove(thisBox);
			for(EventHandler<DialogEvent> handler : handlers){
				handler.handle(event);
			}
		}
	});

	applyStyle();
}
 
开发者ID:DeskChan,项目名称:DeskChan,代码行数:28,代码来源:TemplateBox.java

示例2: prepareDialog

import javafx.scene.control.DialogEvent; //导入依赖的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: end

import javafx.scene.control.DialogEvent; //导入依赖的package包/类
/**
 * Method to be called on song end
 * @param lastReport last GameReport
 */
private void end(GameReport lastReport) {
    Alert alert = new Alert(Alert.AlertType.INFORMATION);
    alert.setTitle("Clone Hero");
    alert.setHeaderText("You've completed this song!");
    alert.setContentText("Your score: " + lastReport.getScore());
    alert.setOnCloseRequest(new EventHandler<DialogEvent>() {
        @Override
        public void handle(DialogEvent event) {
            stage.hide();
        }
    });
    alert.show();
}
 
开发者ID:JavaMugs,项目名称:CloneHero,代码行数:18,代码来源:GameController.java

示例4: addOnCloseRequest

import javafx.scene.control.DialogEvent; //导入依赖的package包/类
public void addOnCloseRequest(EventHandler<DialogEvent> handler){
	handlers.add(handler);
}
 
开发者ID:DeskChan,项目名称:DeskChan,代码行数:4,代码来源:TemplateBox.java

示例5: resetFromModel

import javafx.scene.control.DialogEvent; //导入依赖的package包/类
private void resetFromModel(@SuppressWarnings("UnusedParameters") final DialogEvent dialogEvent) {
    pendingSelectedZoneIds.setValue(observableSet(applicationModel.selectedZoneIds.toArray(new
            ZoneId[applicationModel.selectedZoneIds.size()])));
    zoneIdCheckboxes.stream().forEach(zoneIdCheckBox -> zoneIdCheckBox.setSelected(pendingSelectedZoneIds
            .contains(ZoneId.of(zoneIdCheckBox.getText()))));
}
 
开发者ID:Chessray,项目名称:timezone-converter,代码行数:7,代码来源:ZoneIdSelectionDialog.java

示例6: JFXAlert

import javafx.scene.control.DialogEvent; //导入依赖的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

示例7: friendly_setOnCloseRequest

import javafx.scene.control.DialogEvent; //导入依赖的package包/类
/**
 * {@link Alert#setOnCloseRequest(EventHandler)}.
 * @param handler the {@link EventHandler}.
 */
public void friendly_setOnCloseRequest( EventHandler< DialogEvent > handler ) {
   setOnCloseRequest( handler );
}
 
开发者ID:DanGrew,项目名称:JttDesktop,代码行数:8,代码来源:FriendlyAlert.java

示例8: setOnShowing

import javafx.scene.control.DialogEvent; //导入依赖的package包/类
public final void setOnShowing(EventHandler<DialogEvent> handler) { dialog.setOnShowing(handler);} 
开发者ID:JordanMartinez,项目名称:JGitFX,代码行数:2,代码来源:GitDialog.java

示例9: getOnShowing

import javafx.scene.control.DialogEvent; //导入依赖的package包/类
public final EventHandler<DialogEvent> getOnShowing() { return dialog.getOnShowing(); } 
开发者ID:JordanMartinez,项目名称:JGitFX,代码行数:2,代码来源:GitDialog.java

示例10: setOnShown

import javafx.scene.control.DialogEvent; //导入依赖的package包/类
public final void setOnShown(EventHandler<DialogEvent> handler) { dialog.setOnShown(handler);} 
开发者ID:JordanMartinez,项目名称:JGitFX,代码行数:2,代码来源:GitDialog.java

示例11: getOnShown

import javafx.scene.control.DialogEvent; //导入依赖的package包/类
public final EventHandler<DialogEvent> getOnShown() { return dialog.getOnShown(); } 
开发者ID:JordanMartinez,项目名称:JGitFX,代码行数:2,代码来源:GitDialog.java

示例12: setOnCloseRequest

import javafx.scene.control.DialogEvent; //导入依赖的package包/类
public final void setOnCloseRequest(EventHandler<DialogEvent> handler) {dialog.setOnCloseRequest(handler);} 
开发者ID:JordanMartinez,项目名称:JGitFX,代码行数:2,代码来源:GitDialog.java

示例13: getOnCloseRequest

import javafx.scene.control.DialogEvent; //导入依赖的package包/类
public final EventHandler<DialogEvent> getOnCloseRequest() { return dialog.getOnCloseRequest(); } 
开发者ID:JordanMartinez,项目名称:JGitFX,代码行数:2,代码来源:GitDialog.java

示例14: setOnHiding

import javafx.scene.control.DialogEvent; //导入依赖的package包/类
public final void setOnHiding(EventHandler<DialogEvent> handler) { dialog.setOnHiding(handler);} 
开发者ID:JordanMartinez,项目名称:JGitFX,代码行数:2,代码来源:GitDialog.java

示例15: getOnHiding

import javafx.scene.control.DialogEvent; //导入依赖的package包/类
public final EventHandler<DialogEvent> getOnHiding() { return dialog.getOnHiding(); } 
开发者ID:JordanMartinez,项目名称:JGitFX,代码行数:2,代码来源:GitDialog.java


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