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

x33g5p2x  于2022-01-20 转载在 其他  
字(11.6k)|赞(0)|评价(0)|浏览(147)

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

Hyperlink.setOnAction介绍

暂无

代码示例

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

box.getChildren().clear();
     // for each new link you need to add
       Hyperlink link = new Hyperlink(stringLink);
       link.setOnAction(new EventHandler<ActionEvent>() {
         @Override
         public void handle(ActionEvent t) {
           // do something
         }
       });
       box.getChildren().add(link);
     });

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

@Override
protected void updateItem(Hyperlink item, boolean empty) {
  super.updateItem(item, empty);
  if (!empty){
    item.setOnAction(e -> {
      TeDhenatBlerjes(Integer.parseInt(getTableView().getColumns().get(0).getCellData(getTableRow().getIndex())+""), item.getText());
    });
  }

  // set graphic every time i.e. set it to null for empty cells
  setGraphic(item);
}

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

Hyperlink hl = new Hyperlink(sometext);
hl.setTooltip(new Tooltip(theurlhere);
hl.setOnAction((ActionEvent event) -> {
  Hyperlink h = (Hyperlink) event.getTarget();
  String s = h.getTooltip().getText();
  getHostServices.showDocument(s);
  event.consume();
});

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

/**
 * When the hyperlink is clicked
 */
public void iconOnAction() {
 icon.setOnAction(e -> {
  if(content == null) {
   buildContent();
  }
  tabPane.select(this);
 });
}

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

public class EstadisticasPresenter implements Initializable {

  @FXML Hyperlink linkTotalAlumnos;

  private final BooleanProperty link = new SimpleBooleanProperty();
  public boolean isLink() { return link.get(); }
  public void setLink(boolean value) { link.set(value); }
  public BooleanProperty linkProperty() { return link; }

  @Override public void initialize(URL url, ResourceBundle rb) {
    linkTotalAlumnos.setOnAction((ActionEvent event) -> {
      link.set(true);
    });
  }
}

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

@Override
 public void buildFrom(IEmaginController controller, VLViewComponentXML configuration) {
  ComponentToLabeledHelper.setTooltip(configuration, action, (AbstractViewController) controller);
  IconUtils.setIcon(action, configuration);
  NodeHelper.styleClassSetAll(action, configuration, "form-inline-action");
  action.setOnAction(e -> onAction((AbstractViewController) controller, configuration));
 }
}

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

@Override
public void buildFrom(VLViewComponentXML tabCfg, AbstractViewController controller) {
 this.controller = controller;
 iconAction.setFocusTraversable(false);
 iconAction.getStyleClass().add("vertical-tab-icon");
 final Tooltip tooltip = new Tooltip("All attributes");
 iconAction.setTooltip(tooltip);
 getChildren().add(iconAction);
 iconAction.setOnAction(e -> {
  tabPane.setTabContent(getTabContent());
 });
 setStyle("-fx-max-height: 52");
}

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

/**
 * Constructor
 */
public AttachmentViewer(AbstractViewController controller, String attachmentName, IAttachmentsListLoader iAttachmentsListLoader) {
 this.controller = controller;
 this.iAttachmentsListLoader = iAttachmentsListLoader;
 this.attachmentName = attachmentName;
 getChildren().add(firstRow);
 NodeHelper.setHgrow(firstRow);
 final Label label = new Label(attachmentName);
 // IconUtils.iconify16Container24(download,
 // FontAwesomeIcon.DOWNLOAD.toString());
 download.setOnAction(e -> {
  downloadAttachment();
 });
 // IconUtils.iconify16Container24(view,
 // FontAwesomeIcon.EYE.toString());
 view.setOnAction(e -> {
 });
 firstRow.getChildren().addAll(label, NodeHelper.horizontalSpacer(), download, view);
 firstRow.setStyle("-fx-alignment:CENTER_LEFT;" + "-fx-spacing: 8;");
 setStyle("-fx-spacing: 16;");
}

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

protected void buildActionsArea() {
 actionsContainer.getStyleClass().add("notification-view-actions-container");
 actionsContainer.getChildren().addAll(deleteAction);
 deleteAction.setOnAction(e -> delete());
 deleteAction.setOpacity(0.54);
 deleteAction.setFocusTraversable(false);
 deleteAction.getStyleClass().addAll("button-transparent-border-primary", "scale-down-on-click");
 deleteAction.setText(controller.getGLocalised("REMOVE_LABEL").toUpperCase());
 // IconUtils.setFontIcon("mdi-close:14", "grey-ikonli", deleteAction);
}

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

/**
 * {@inheritDoc}
 */
@Override
public void buildFrom(IEmaginController controller, VLViewComponentXML configuration) {
 getChildren().add(pane);
 getStyleClass().add("simple-forward-editor-header-external-wrapper");
 pane.getStyleClass().add("simple-forward-editor-header");
 backButton.getStyleClass().addAll("rounded-primary-button-button", "transparent-focus");
 doneDutton.getStyleClass().addAll("rounded-primary-button-button", "transparent-focus");
 backButton.setText(controller.getGLocalised("BACK_LABEL"));
 doneDutton.setText(controller.getGLocalised("DONE_LABEL"));
 IconUtils.setFontIcon("fa-long-arrow-left:10", backButton);
 IconUtils.setFontIcon("fa-check:10", doneDutton);
 pane.getChildren().addAll(backButton, NodeHelper.horizontalSpacer(), doneDutton);
 backButton.setOnAction(e -> onCancel());
 doneDutton.setOnAction(e -> onOk());
}

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

/**
 * @{inheritedDoc}
 */
@Override
public void buildFrom(IEmaginController controller, VLViewComponentXML tabConfiguration) {
 IconUtils.setIcon(iconNode, tabConfiguration);
 setTabIcon(iconNode);
 String title = NodeHelper.getTitle(tabConfiguration, (AbstractViewController) controller);
 setTabTile(title);
 iconNode.setContentDisplay(ContentDisplay.GRAPHIC_ONLY);
 iconNode.setTooltip(new Tooltip(title));
 iconNode.setOnAction(e -> listviewPaneContent.select(this));
 getChildren().add(iconNode);
}

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

protected void buildCloseButton() {
 boolean showAsDialog = Boolean.valueOf(configuration.getPropertyValue(XMLConstants.DIALOG));
 if(showAsDialog) {
  Hyperlink link = new Hyperlink();
  link.getStyleClass().add("transparent-focus");
  FontIcon icon = new FontIcon("mdi-close:32");
  link.setGraphic(icon);
  icon.getStyleClass().add("wizard-close-icon");
  layout.getChildren().addAll(NodeHelper.horizontalSpacer(), link);
  if (controller instanceof WizardViewController) {
   link.setOnAction(e -> ((WizardViewController) controller).hide());
  }
 }
 else {
  layout.getChildren().addAll(NodeHelper.horizontalSpacer());
 }
}

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

private void buildNonFloatingRightActionsButton() {
 popOverFloatingPane.managedProperty().bind(popOverFloatingPane.visibleProperty());
 showRightPaneButton.managedProperty().bind(showRightPaneButton.visibleProperty());
 hideRightPaneButton.managedProperty().bind(hideRightPaneButton.visibleProperty());
 showRightPaneButton.visibleProperty().bind(Bindings.not(hideRightPaneButton.visibleProperty()));
 IconUtils.setFontIcon("fa-angle-double-left:20", showRightPaneButton);
 showRightPaneButton.getGraphic().getStyleClass().add("grey-ikonli");
 showRightPaneButton.getStyleClass().add("transparent-focus");
 showRightPaneButton.setOnAction(e -> {
  openRightPane();
 });
 IconUtils.setFontIcon("fa-angle-double-right:20", hideRightPaneButton);
 hideRightPaneButton.getGraphic().getStyleClass().add("grey-ikonli");
 hideRightPaneButton.getStyleClass().add("transparent-focus");
 hideRightPaneButton.setOnAction(e -> {
  closeRightPane();
 });
}

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

private void buildFilterToolbar() {
 filtersToolbar.setStyle("-fx-background-color: white;" + "-fx-alignment:CENTER_LEFT;" + "-fx-padding: 16 16 16 64;" + "-fx-spacing:16;" + "-fx-border-color: -grey-color-300;"
   + "-fx-border-width: 0 0 1 0;" + "-fx-pref-height: 48;");
 getChildren().add(filtersToolbar);
 NodeHelper.setHgrow(filtersToolbar);
 filtersToolbar.managedProperty().bind(filtersToolbar.visibleProperty());
 final Hyperlink filterToolBarButton = new Hyperlink();
 defaultToolbar.getChildren().add(filterToolBarButton);
 filterToolBarButton.setOnAction(e -> {
  filtersToolbar.visibleProperty().set(!filtersToolbar.visibleProperty().get());
 });
 filtersToolbar.setVisible(false);
}

代码示例来源:origin: Tristan971/Lyrebird

private void displayApplicationAuthor() {
  applicationAuthorProfileLink.setOnAction(e -> userDetailsService.openUserDetails("_tristan971_"));
  userDetailsService.findUser("_tristan971_")
           .map(User::getProfileImageURLHttps)
           .map(cachedMedia::loadImage)
           .onSuccess(applicationAuthorProfilePicture::setImage)
           .andThen(() -> applicationAuthorProfilePicture.setClip(Clipping.getCircleClip(16.0)));
}

代码示例来源:origin: Tristan971/Lyrebird

@Override
public void initialize() {
  creditedWork.addListener((o, prev, cur) -> {
    if (cur != null) {
      Platform.runLater(() -> {
        title.setText(cur.getTitle());
        author.setText(cur.getAuthor().getName());
        author.setOnAction(e -> browserSupport.openUrl(cur.getAuthor().getUrl()));
        licensor.setText(cur.getLicensor().getName());
        licensor.setOnAction(e -> browserSupport.openUrl(cur.getLicensor().getUrl()));
        license.setText(cur.getLicense().getName());
        license.setOnAction(e -> browserSupport.openUrl(cur.getLicense().getUrl()));
      });
    }
  });
}

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

/**
  * @return
  */
 protected ButtonBase getPinOrCloseButton() {
  Hyperlink button = new Hyperlink();
  IconUtils.setFontIcon("mdi-close:22", button);
  button.getGraphic().getStyleClass().addAll("red-ikonli", "transparent-focus");
  button.setContentDisplay(ContentDisplay.GRAPHIC_ONLY);

  button.setOnAction(e -> {
   CloseMenuEvent closeMenuEvent = new CloseMenuEvent(MenuPos.TERNARY_MENU);
   dispatchEvent(closeMenuEvent);
  });

  return button;
 }
}

代码示例来源:origin: com.nexitia.emaginplatform/emagin-jfxplatform-components

@Override
protected void updateItem(ObjectModel item, boolean empty) {
 super.updateItem(item, empty);
 setGraphic(null);
 setText(null);
 setStyle("-fx-padding:0");
 if (!empty) {
  layout.setStyle("-fx-pref-height: 48; " + "-fx-background-color: transparent;" + "-fx-border-color: -external-border-color; " + "-fx-border-width: 0.03;"
    + "-fx-alignment: CENTER_LEFT; -fx-padding: 0 16 0 16;");
  final Hyperlink content = new Hyperlink();
  content.setStyle("-fx-text-fill: -primary-text-color; -fx-underline: false; -fx-font-size:16px;-fx-font-family:'Roboto Regular';");
  content.setFocusTraversable(false);
  content.setText(item.getName());
  content.setOnAction(e -> {
   loadChildrenFuntion.apply(item);
  });
  layout.getChildren().clear();
  layout.getChildren().add(content);
  setGraphic(layout);
 }
}

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

/**
 * @param configuration
 * @param controller
 * @param contextualTo
 */
public void build(List<VLViewComponentXML> configuration, AbstractViewController controller, CriteriaContext criteriaContext, Node contextualTo) {
 contextMenu = new ContextMenu(controller, configuration, criteriaContext);
 contextMenu.setContextualTo(contextualTo);
 ellipsisButton.managedProperty().bind(ellipsisButton.visibleProperty());
 ellipsisButton.setOnAction(e -> {
  e.consume();
  if (contextMenu.isShowing()) {
   contextMenu.hide();
   return;
  }
  contextMenu.show(ellipsisButton);
 });
}

代码示例来源:origin: com.bitplan.gui/com.bitplan.javafx

/**
 * get the flowPane for the Exception Help
 * 
 * @param ehelp
 * @param linker
 */
public static FlowPane getFlowPane(ExceptionHelp ehelp, Linker linker) {
 FlowPane fp = new FlowPane();
 Label lbl = new Label(Translator.translate(ehelp.getI18nHint()));
 Hyperlink link = new Hyperlink(Translator.translate("help"));
 fp.getChildren().addAll(lbl, link);
 link.setOnAction((evt) -> {
  linker.browse(ehelp.getUrl());
 });
 return fp;
}

相关文章