javafx.scene.control.Button.addEventFilter()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(7.3k)|赞(0)|评价(0)|浏览(214)

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

Button.addEventFilter介绍

暂无

代码示例

代码示例来源:origin: stackoverflow.com

final Button okButton = (Button) dialog.getDialogPane().lookupButton(ButtonType.OK);
okButton.addEventFilter(ActionEvent.ACTION, ae -> {
  if (!isValid()) {
    ae.consume(); //not valid
  }
});

代码示例来源:origin: stackoverflow.com

final Button btOk = (Button) dlg.getDialogPane().lookupButton(ButtonType.OK);
btOk.addEventFilter(ActionEvent.ACTION, event -> {
  if (!validateAndStore()) {
    event.consume();
  }
});

代码示例来源:origin: stackoverflow.com

final Button btOk = (Button) dlg.getDialogPane().lookupButton(ButtonType.OK);
btOk.addEventFilter(ActionEvent.ACTION, event -> {
  if (!validateAndStore()) {
    event.consume();
  }
});

代码示例来源:origin: com.nexitia.emaginplatform/emagin-jfxcore-engine

/**
 * Constructor
 */
public ProcessingButton() {
 super();
 button.addEventFilter(ActionEvent.ACTION, this::handle);
}

代码示例来源:origin: stackoverflow.com

final Button cancel = (Button) dialog.getDialogPane().lookupButton(ButtonType.CANCEL);
cancel.addEventFilter(ActionEvent.ACTION, event ->
  System.out.println("Cancel was definitely pressed")
);

代码示例来源:origin: com.nexitia.emaginplatform/emagin-jfxcore-engine

/**
 * Default Constructor
 */
public FullTableEditorPane() {
 getStyleClass().add("ep-full-table-editor-pane");
 // header.getStyleClass().add("ep-full-table-editor-pane-header");
 IconUtils.setFontIcon("fa-rotate-left:16", closeAction);
 closeAction.addEventFilter(ActionEvent.ACTION, this::popContent);
 closeAction.getStyleClass().add("button-transparent");
 IconUtils.setFontIcon("fa-angle-double-down:22", minimizeAction);
 minimizeAction.addEventFilter(ActionEvent.ACTION, this::minimizePushedContent);
 minimizeAction.getStyleClass().add("button-transparent");
}

代码示例来源:origin: stackoverflow.com

button.addEventFilter(MouseEvent.MOUSE_PRESSED, e -> {
  System.out.println("paste pressed");

代码示例来源:origin: com.nexitia.emaginplatform/emagin-jfxcore-engine

/**
 * Constructor
 */
public SimpleButton() {
 super();
 button = new JFXButton();
 button.addEventFilter(ActionEvent.ACTION, this::handle);
 button.setCursor(Cursor.HAND);
 button.getStyleClass().removeAll("button");
 button.getStyleClass().add("ep-button");
}

代码示例来源:origin: com.nexitia.emaginplatform/emagin-jfxcore-engine

@Override
protected DialogStageWrapper _beforeShow() {
 dialogStageWrapper = new DialogStageWrapper();
 okButton.addEventFilter(ActionEvent.ACTION, e -> {
  dialogStageWrapper.hide();
  if (callBack != null) {
   callBack.apply(this);
  }
 });
 dialogFooter.setActions(okButton);
 dialogStageWrapper.setContent(this.getDisplay());
 return dialogStageWrapper;
}

代码示例来源:origin: com.nexitia.emaginplatform/emagin-jfxcore-engine

@Override
protected DialogStageWrapper _beforeShow() {
 dialogStageWrapper = new DialogStageWrapper();
 okButton.addEventFilter(ActionEvent.ACTION, e -> {
  dialogStageWrapper.hide();
  if (callBack != null) {
   callBack.apply(this);
  }
 });
 dialogFooter.setActions(okButton);
 dialogStageWrapper.setContent(this.getDisplay());
 return dialogStageWrapper;
}

代码示例来源:origin: com.nexitia.emaginplatform/emagin-jfxcore-engine

@Override
protected DialogStageWrapper _beforeShow() {
 dialogStageWrapper = new DialogStageWrapper();
 if(callBack != null) {
  okButton.addEventFilter(ActionEvent.ACTION, e -> {
   dialogStageWrapper.hide();
   if (callBack != null) {
    callBack.apply(this);
   }
  });
  dialogFooter.setActions(okButton);
 }
 dialogStageWrapper.setContent(this.getDisplay());
 return dialogStageWrapper;
}

代码示例来源:origin: com.nexitia.emaginplatform/emagin-jfxcore-engine

@Override
protected DialogStageWrapper _beforeShow() {
 dialogStageWrapper = new DialogStageWrapper();
 okButton.getStyleClass().add("ep-button");
 okButton.addEventFilter(ActionEvent.ACTION, e -> {
  dialogStageWrapper.hide();
  if (okCallBack != null) {
   okCallBack.apply(this);
  }
 });
 okButton.getStyleClass().add("ep-button");
 cancelButton.addEventFilter(ActionEvent.ACTION, e -> {
  dialogStageWrapper.hide();
  if (cancelCallBack != null) {
   cancelCallBack.apply(this);
  }
 });
 final HBox c = new HBox(cancelButton, okButton);
 c.setStyle("-fx-alignment:CENTER_RIGHT;-fx-spacing:8");
 dialogFooter.setActions(c);
 dialogStageWrapper.setContent(this.getDisplay());
 return dialogStageWrapper;
}

代码示例来源:origin: ssaring/sportstracker

@Override
protected void addCustomButtons(final DialogPane dialogPane) {
  // add 'Calculate' button to button bar
  final ButtonType bTypeCalculate = new ButtonType(context.getResources().getString(
      "st.dlg.statistic.calculate.Action.text"), ButtonBar.ButtonData.OK_DONE);
  dialogPane.getButtonTypes().add(bTypeCalculate);
  final Button buttonCalculate = (Button) dialogPane.lookupButton(bTypeCalculate);
  // set action event filter for this custom button
  // => the event must be consumed, otherwise the dialog will be closed
  buttonCalculate.addEventFilter(ActionEvent.ACTION, (event) -> {
    event.consume();
    onCalculate(event);
  });
}

代码示例来源:origin: stackoverflow.com

loginButton.setDisable(true);
loginButton.addEventFilter(ActionEvent.ACTION, (event) -> { 
 if (!authenticated()) { 
  event.consume();

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

buttons.add(BUTTON_PREVIOUS);
Button button = (Button)currentPage.lookupButton(BUTTON_PREVIOUS);
button.addEventFilter(ActionEvent.ACTION, BUTTON_PREVIOUS_ACTION_HANDLER);
button.addEventFilter(ActionEvent.ACTION, BUTTON_NEXT_ACTION_HANDLER);

代码示例来源:origin: stackoverflow.com

button.addEventFilter(MouseEvent.MOUSE_PRESSED, e -> {
  modifyClipboard();
});

代码示例来源:origin: ssaring/sportstracker

btOk.addEventFilter(ActionEvent.ACTION, (event) -> {
  if (!validateAndStore()) {
    event.consume();

代码示例来源:origin: com.nexitia.emaginplatform/emagin-jfxcore-engine

protected ButtonBase build(VLViewComponentXML configuration) {
 if ("button".equals(type)) {
  Button buttonAction = new JFXButton();
  buttonAction.getStyleClass().remove(0);
  buttonAction.getStyleClass().removeAll("jfx-button", "button");
  buttonAction.managedProperty().bind(buttonAction.visibleProperty());
  NodeHelper.setTitle(buttonAction, configuration, controller);
  IconUtils.setIcon(buttonAction, configuration);
  NodeHelper.setStyleClass(buttonAction, configuration, "styleClass", true);
  buttonAction.getStyleClass().add("ep-button");
  String displayMode = configuration.getPropertyValue(XMLConstants.HYPERLINK_DISPLAY_MODE, "LEFT");
  buttonAction.setContentDisplay(ContentDisplay.valueOf(displayMode));
  boolean readOnly = configuration.getBooleanProperty("readOnly", false);
  buttonAction.setDisable(readOnly);
  buttonAction.addEventFilter(ActionEvent.ACTION, e -> onAction(buttonAction));
  return buttonAction;
 } else {
  Hyperlink hyperlinkAction = new Hyperlink();
  hyperlinkAction.managedProperty().bind(hyperlinkAction.visibleProperty());
  NodeHelper.setTitle(hyperlinkAction, configuration, controller);
  NodeHelper.setStyleClass(hyperlinkAction, configuration, "styleClass", true);
  IconUtils.setIcon(hyperlinkAction, configuration);
  boolean readOnly = configuration.getBooleanProperty("readOnly", false);
  hyperlinkAction.setDisable(readOnly);
  hyperlinkAction.addEventFilter(ActionEvent.ACTION, e -> onAction(hyperlinkAction));
  return hyperlinkAction;
 }
}

代码示例来源:origin: eu.binjr/binjr-adapter-rrd4j

Platform.runLater(pathsField::requestFocus);
okButton.addEventFilter(ActionEvent.ACTION, ae -> {
  try {
    result = getDataAdapter();

相关文章