javafx.event.EventHandler.handle()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(7.2k)|赞(0)|评价(0)|浏览(173)

本文整理了Java中javafx.event.EventHandler.handle()方法的一些代码示例,展示了EventHandler.handle()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。EventHandler.handle()方法的具体详情如下:
包路径:javafx.event.EventHandler
类名称:EventHandler
方法名:handle

EventHandler.handle介绍

暂无

代码示例

代码示例来源:origin: jfoenixadmin/JFoenix

public static <T extends Event> EventHandler<? super T> addDelayedEventHandler(Node control, Duration delayTime,
                             final EventType<T> eventType,
                             final EventHandler<? super T> eventHandler) {
  Wrapper<T> eventWrapper = new Wrapper<>();
  PauseTransition holdTimer = new PauseTransition(delayTime);
  holdTimer.setOnFinished(finish -> eventHandler.handle(eventWrapper.content));
  final EventHandler<? super T> eventEventHandler = event -> {
    eventWrapper.content = event;
    holdTimer.playFromStart();
  };
  control.addEventHandler(eventType, eventEventHandler);
  return eventEventHandler;
}

代码示例来源:origin: jfoenixadmin/JFoenix

private void selectItem() {
  T item = suggestionList.getSelectionModel().getSelectedItem();
  if (item == null) {
    try {
      suggestionList.getSelectionModel().select(0);
      item = suggestionList.getSelectionModel().getSelectedItem();
    } catch (Exception e) {
    }
  }
  if (item != null) {
    control.getSelectionHandler().handle(new JFXAutoCompleteEvent<T>(JFXAutoCompleteEvent.SELECTION, item));
  }
}

代码示例来源:origin: jfoenixadmin/JFoenix

public static void addPressAndHoldFilter(Node node, Duration holdTime,
                     EventHandler<MouseEvent> handler) {
  Wrapper<MouseEvent> eventWrapper = new Wrapper<>();
  PauseTransition holdTimer = new PauseTransition(holdTime);
  holdTimer.setOnFinished(event -> handler.handle(eventWrapper.content));
  node.addEventFilter(MouseEvent.MOUSE_PRESSED, event -> {
    eventWrapper.content = event;
    holdTimer.playFromStart();
  });
  node.addEventFilter(MouseEvent.MOUSE_RELEASED, event -> holdTimer.stop());
  node.addEventFilter(MouseEvent.DRAG_DETECTED, event -> holdTimer.stop());
}

代码示例来源:origin: jfoenixadmin/JFoenix

public static void addPressAndHoldHandler(Node node, Duration holdTime,
                     EventHandler<MouseEvent> handler) {
  Wrapper<MouseEvent> eventWrapper = new Wrapper<>();
  PauseTransition holdTimer = new PauseTransition(holdTime);
  holdTimer.setOnFinished(event -> handler.handle(eventWrapper.content));
  node.addEventHandler(MouseEvent.MOUSE_PRESSED, event -> {
    eventWrapper.content = event;
    holdTimer.playFromStart();
  });
  node.addEventHandler(MouseEvent.MOUSE_RELEASED, event -> holdTimer.stop());
  node.addEventHandler(MouseEvent.DRAG_DETECTED, event -> holdTimer.stop());
}

代码示例来源:origin: pmd/pmd

autoCompletePopup.getItems().get(focusIdx).getOnAction().handle(new ActionEvent());

代码示例来源:origin: com.aquafx-project/aquafx

@Override public void handle(ActionEvent event) {
    embeddedPerformanceMode = embeddedPerformanceButton.isSelected();
    rebuild.handle(event);
  }
}).build(), new Separator(), retinaButton, new Label("Base:"), createBaseColorPicker(), new Label("Background:"), createBackgroundColorPicker(), new Label("Accent:"), createAccentColorPicker(), new Separator(), ButtonBuilder.create().text(

代码示例来源:origin: org.drombler.commons/drombler-commons-action-fx

/**
   * {@inheritDoc }
   */
  @Override
  public void handle(ActionEvent e) {
    getAdapted().handle(e);
  }
}

代码示例来源:origin: com.dlsc.formsfx/formsfx-core

protected void fireEvent(GroupEvent event) {
    List<EventHandler<? super GroupEvent>> list = this.eventHandlers.get(event.getEventType());
    if (list == null) {
      return;
    }
    for (EventHandler<? super GroupEvent> eventHandler : list) {
      if (!event.isConsumed()) {
        eventHandler.handle(event);
      }
    }
  }
}

代码示例来源:origin: com.dlsc.formsfx/formsfx-core

protected void fireEvent(FieldEvent event) {
  List<EventHandler<? super FieldEvent>> list = this.eventHandlers.get(event.getEventType());
  if (list == null) {
    return;
  }
  for (EventHandler<? super FieldEvent> eventHandler : list) {
    if (!event.isConsumed()) {
      eventHandler.handle(event);
    }
  }
}

代码示例来源:origin: org.codehaus.griffon/griffon-javafx

private static EventHandler<ActionEvent> wrapAction(@Nonnull final JavaFXAction action) {
  return event -> {
    if (action.isEnabled()) {
      action.getOnAction().handle(event);
    }
  };
}

代码示例来源:origin: com.dlsc.formsfx/formsfx-core

protected void fireEvent(FormEvent event) {
    List<EventHandler<? super FormEvent>> list = this.eventHandlers.get(event.getEventType());
    if (list == null) {
      return;
    }
    for (EventHandler<? super FormEvent> eventHandler : list) {
      if (!event.isConsumed()) {
        eventHandler.handle(event);
      }
    }
  }
}

代码示例来源:origin: org.codehaus.griffon/griffon-javafx

@Override
protected void doExecute(Object... args) {
  ActionEvent event = null;
  if (args != null && args.length == 1 && args[0] instanceof ActionEvent) {
    event = (ActionEvent) args[0];
  }
  toolkitAction.onActionProperty().get().handle(event);
}

代码示例来源:origin: org.gillius/jfxutils

private boolean passesFilter( MouseEvent event ) {
  if ( mouseFilter != null ) {
    MouseEvent cloned = (MouseEvent) event.clone();
    mouseFilter.handle( cloned );
    if ( cloned.isConsumed() )
      return false;
  }
  return true;
}

代码示例来源:origin: org.controlsfx/controlsfx

@Override public void handle(final ActionEvent event) {
    EventHandler<ActionEvent> onActionHandler = getSkinnable().getOnAction();
    if (onActionHandler != null) {
      onActionHandler.handle(event);
    }
  }
};

代码示例来源:origin: ch.sahits.game/OpenPatricianDisplay

@Override
protected EventHandler<MouseEvent> createNextAction() {
  return event -> {
    dialogUtil.createNextActionForShips(city.getPlayersShips(), currentShip).handle(event);
    selectionChanged();
  };
}

代码示例来源:origin: ch.sahits.game/OpenPatricianDisplay

@Override
protected EventHandler<MouseEvent> createNextAction() {
  return event -> {
    dialogUtil.createNextActionForShips(city.getPlayersShips(), currentShip).handle(event);
    selectionChanged();
  };
}

代码示例来源:origin: ch.sahits.game/OpenPatricianDisplay

@Override
protected EventHandler<MouseEvent> createPreviousAction() {
  return event -> {
    dialogUtil.createPreviousActionForShips(city.getPlayersShips(), currentShip).handle(event);
    selectionChanged();
  };
}

代码示例来源:origin: eu.mihosoft.vrl.workflow/vworkflows-fx

public DefaultWindowIconSkin(final WindowIcon c) {
    super(c);

    getNode().setCursor(Cursor.DEFAULT);

    getNode().onMouseClickedProperty().set((EventHandler<MouseEvent>) (MouseEvent t) -> {
      if (c.getOnAction()!=null) {
        c.getOnAction().handle(new ActionEvent(t, c));
      }
    });

  }
}

代码示例来源:origin: com.jfoenix/jfoenix

public static void addPressAndHoldHandler(Node node, Duration holdTime,
                     EventHandler<MouseEvent> handler) {
  Wrapper<MouseEvent> eventWrapper = new Wrapper<>();
  PauseTransition holdTimer = new PauseTransition(holdTime);
  holdTimer.setOnFinished(event -> handler.handle(eventWrapper.content));
  node.addEventHandler(MouseEvent.MOUSE_PRESSED, event -> {
    eventWrapper.content = event;
    holdTimer.playFromStart();
  });
  node.addEventHandler(MouseEvent.MOUSE_RELEASED, event -> holdTimer.stop());
  node.addEventHandler(MouseEvent.DRAG_DETECTED, event -> holdTimer.stop());
}

代码示例来源:origin: com.jfoenix/jfoenix

public static void addPressAndHoldFilter(Node node, Duration holdTime,
                     EventHandler<MouseEvent> handler) {
  Wrapper<MouseEvent> eventWrapper = new Wrapper<>();
  PauseTransition holdTimer = new PauseTransition(holdTime);
  holdTimer.setOnFinished(event -> handler.handle(eventWrapper.content));
  node.addEventFilter(MouseEvent.MOUSE_PRESSED, event -> {
    eventWrapper.content = event;
    holdTimer.playFromStart();
  });
  node.addEventFilter(MouseEvent.MOUSE_RELEASED, event -> holdTimer.stop());
  node.addEventFilter(MouseEvent.DRAG_DETECTED, event -> holdTimer.stop());
}

相关文章

EventHandler类方法