本文整理了Java中javafx.stage.Window.addEventFilter()
方法的一些代码示例,展示了Window.addEventFilter()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Window.addEventFilter()
方法的具体详情如下:
包路径:javafx.stage.Window
类名称:Window
方法名:addEventFilter
暂无
代码示例来源:origin: jfoenixadmin/JFoenix
eventHandlerManager.addEventHandler(DialogEvent.DIALOG_HIDDEN, event -> removeLayoutListeners());
getDialogPane().getScene().getWindow().addEventFilter(KeyEvent.KEY_PRESSED, keyEvent -> {
if (keyEvent.getCode() == KeyCode.ESCAPE) {
if (!isHideOnEscape()) {
代码示例来源:origin: org.controlsfx/controlsfx
/** {@inheritDoc} */
@Override
public final void show(Window owner) {
super.show(owner);
ownerWindow = owner;
if (isAnimated()) {
showFadeInAnimation(getFadeInDuration());
}
ownerWindow.addEventFilter(WindowEvent.WINDOW_CLOSE_REQUEST,
closePopOverOnOwnerWindowClose);
ownerWindow.addEventFilter(WindowEvent.WINDOW_HIDING,
closePopOverOnOwnerWindowClose);
}
代码示例来源:origin: org.controlsfx/controlsfx
/** {@inheritDoc} */
@Override
public final void show(Window ownerWindow, double anchorX, double anchorY) {
super.show(ownerWindow, anchorX, anchorY);
this.ownerWindow = ownerWindow;
if (isAnimated()) {
showFadeInAnimation(getFadeInDuration());
}
ownerWindow.addEventFilter(WindowEvent.WINDOW_CLOSE_REQUEST,
closePopOverOnOwnerWindowClose);
ownerWindow.addEventFilter(WindowEvent.WINDOW_HIDING,
closePopOverOnOwnerWindowClose);
}
代码示例来源:origin: dev.rico/rico-remoting-client-javafx
/**
* The method will register an event handler to the window that will automatically call the {@link AbstractViewController#destroy()}
* method when the windows becomes hidden.
* @param window the window
* @param viewBinder the view binder
* @param <M> the model type
* @return a subscription to unsubsribe / deregister the handler.
*/
public static <M> Subscription destroyOnClose(final Window window, final AbstractViewController<M> viewBinder) {
Assert.requireNonNull(window, "window");
Assert.requireNonNull(viewBinder, "viewBinder");
final EventHandler<WindowEvent> handler = e -> viewBinder.destroy();
window.addEventFilter(WindowEvent.WINDOW_HIDDEN, handler);
return () -> window.removeEventFilter(WindowEvent.WINDOW_HIDDEN, handler);
}
代码示例来源:origin: com.canoo.dolphin-platform/dolphin-platform-client-javafx
/**
* The method will register an event handler to the window that will automatically call the {@link AbstractViewBinder#destroy()}
* method when the windows becomes hidden.
* @param window the window
* @param viewBinder the view binder
* @param <M> the model type
* @return a subscription to unsubsribe / deregister the handler.
*/
public static <M> Subscription destroyOnClose(final Window window, final AbstractViewBinder<M> viewBinder) {
Assert.requireNonNull(window, "window");
Assert.requireNonNull(viewBinder, "viewBinder");
final EventHandler<WindowEvent> handler = e -> viewBinder.destroy();
window.addEventFilter(WindowEvent.WINDOW_HIDDEN, handler);
return () -> window.removeEventFilter(WindowEvent.WINDOW_HIDDEN, handler);
}
代码示例来源:origin: org.tentackle/tentackle-fx
/**
* Registers event filters for windows.
*
* @param window the window
*/
public void registerWindowEventFilters(Window window) {
window.addEventFilter(MouseEvent.ANY, event -> {
if (event.isShiftDown() && event.isControlDown() && !event.isMetaDown() && !event.isAltDown() &&
event.isPopupTrigger()) {
PickResult pickResult = event.getPickResult();
if (pickResult != null) {
Node node = pickResult.getIntersectedNode();
if (node != null) {
LOGGER.info(() -> "\n" + dumpComponentHierarchy(node));
}
}
}
});
}
代码示例来源:origin: org.controlsfx/controlsfx
ownerWindow.addEventFilter(WindowEvent.WINDOW_CLOSE_REQUEST,
closePopOverOnOwnerWindowClose);
ownerWindow.addEventFilter(WindowEvent.WINDOW_HIDING,
closePopOverOnOwnerWindowClose);
代码示例来源:origin: com.jfoenix/jfoenix
eventHandlerManager.addEventHandler(DialogEvent.DIALOG_HIDDEN, event -> removeLayoutListeners());
getDialogPane().getScene().getWindow().addEventFilter(KeyEvent.KEY_PRESSED, keyEvent -> {
if (keyEvent.getCode() == KeyCode.ESCAPE) {
if (!isHideOnEscape()) {
内容来源于网络,如有侵权,请联系作者删除!