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

x33g5p2x  于2022-01-30 转载在 其他  
字(9.0k)|赞(0)|评价(0)|浏览(169)

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

Tooltip.install介绍

暂无

代码示例

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

private void updateRecentFilesMenu() {
  List<MenuItem> items = new ArrayList<>();
  List<File> filesToClear = new ArrayList<>();
  for (final File f : recentFiles) {
    if (f.exists() && f.isFile()) {
      CustomMenuItem item = new CustomMenuItem(new Label(f.getName()));
      item.setOnAction(e -> loadSourceFromFile(f));
      item.setMnemonicParsing(false);
      Tooltip.install(item.getContent(), new Tooltip(f.getAbsolutePath()));
      items.add(item);
    } else {
      filesToClear.add(f);
    }
  }
  recentFiles.removeAll(filesToClear);
  if (items.isEmpty()) {
    openRecentMenu.setDisable(true);
    return;
  }
  Collections.reverse(items);
  items.add(new SeparatorMenuItem());
  MenuItem clearItem = new MenuItem();
  clearItem.setText("Clear menu");
  clearItem.setOnAction(e -> {
    recentFiles.clear();
    openRecentMenu.setDisable(true);
  });
  items.add(clearItem);
  openRecentMenu.getItems().setAll(items);
}

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

Tooltip.install(this, tooltip);
oldTooltip = tooltip;

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

private ContextMenu buildContextMenu(Node item) {
  ContextMenu contextMenu = new ContextMenuWithNoArrows();
  CustomMenuItem menuItem = new CustomMenuItem(new Label("Copy subtree test to clipboard..."));
  Tooltip tooltip = new Tooltip("Creates a node spec using the Kotlin AST matcher DSL, and dumps it to the clipboard");
  Tooltip.install(menuItem.getContent(), tooltip);
  menuItem.setOnAction(e -> {
    Clipboard clipboard = Clipboard.getSystemClipboard();
    ClipboardContent content = new ClipboardContent();
    content.putString(dumpToSubtreeTest(item)); // item is captured in the closure
    clipboard.setContent(content);
  });
  contextMenu.getItems().add(menuItem);
  return contextMenu;
}

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

viewGlyphDetail(glyph);
});
Tooltip.install(button, new Tooltip(glyph.getName()));
return button;

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

Tooltip.install(this, new Tooltip((tooltipStr == null) ? "" : tooltipStr.toUpperCase()));

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

final Tooltip tooltip = new Tooltip(tooltipText);
Tooltip.install(pane, tooltip);
menu.getItems().add(item);

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

Tooltip.install(this, tooltip);
oldTooltip = tooltip;

代码示例来源:origin: it.unibo.alchemist/alchemist-projectview

private void setDeleteIcon(final GridPane grid, final Label label, final ImageView imgView, final boolean isYaml) {
  final Tooltip tooltip = new Tooltip();
  tooltip.setText(RESOURCES.getString("delete"));
  Tooltip.install(imgView, tooltip);
  grid.getChildren().remove(imgView);
  grid.add(imgView, 0, 2);
  imgView.addEventHandler(MouseEvent.MOUSE_CLICKED, new EventHandler<MouseEvent>() {
    @Override
    public void handle(final MouseEvent event) {
      label.setText("");
      grid.getChildren().remove(imgView);
      if (isYaml) {
        setSwitchBatchSelected(false);
      }
    }
  });
}

代码示例来源:origin: io.github.factoryfx/javafxDataEditing

if (node.getStyleClass().stream().noneMatch(c -> c.equals("error"))) node.getStyleClass().add("error");
Tooltip.install(node, tooltip);

代码示例来源:origin: org.jfxtras/jfxtras-menu

CirclePopupMenuNode (MenuItem menuItem) {
  this.menuItem = menuItem;
  setId(this.getClass().getSimpleName() + "#" + menuNodeIdAtomicLong.incrementAndGet());
  
  // show the graphical part
  if (menuItem.getGraphic() == null) {
    throw new NullPointerException("MenuItems in CirclePopupMenu require a graphical part, text is optional");
  }
  getChildren().add(menuItem.getGraphic());
  // show the text as a tooltip
  if (menuItem.getText() != null && menuItem.getText().length() > 0) {
    Tooltip t = new Tooltip(menuItem.getText());
    Tooltip.install(this, t);
  }
  
  // react on a mouse click to perform the menu action
  setOnMouseClicked( (eventHandler) -> {
    hide();
    if (menuItem.getOnAction() != null) {
      menuItem.getOnAction().handle(null);
    }
  });
}
final private MenuItem menuItem;

代码示例来源:origin: org.jfxtras/jfxtras-menu

CornerMenuNode (MenuItem menuItem) {
  this.menuItem = menuItem;
  setId(this.getClass().getSimpleName() + "#" + menuNodeIdAtomicLong.incrementAndGet());
  
  // show the graphical part
  if (menuItem.getGraphic() == null) {
    throw new NullPointerException("MenuItems in CornerMenu require a graphical part, text is optional");
  }
  getChildren().add(menuItem.getGraphic());
  // show the text as a tooltip
  if (menuItem.getText() != null && menuItem.getText().length() > 0) {
    Tooltip t = new Tooltip(menuItem.getText());
    Tooltip.install(this, t);
  }
  
  // react on a mouse click to perform the menu action
  setOnMouseClicked( (eventHandler) -> {
    if (isAutoShowAndHide()) {
      hide();
    }
    if (menuItem.getOnAction() != null) {
      menuItem.getOnAction().handle(null);
    }
  });
}
final private MenuItem menuItem;

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

/**
 * Constructs a new map view with an initially empty list of countries which will
 * result in the entire world to be shown.
 */
public WorldMapView() {
  getStyleClass().add(DEFAULT_STYLE_CLASS);
  setCountryViewFactory(country -> {
    CountryView view = new CountryView(country);
    view.setOnMouseEntered(evt -> tooltip.setText(country.getLocale().getDisplayCountry()));
    Tooltip.install(view, tooltip);
    return view;
  });
  setLocationViewFactory(location -> {
    Circle circle = new Circle();
    circle.setRadius(4);
    circle.setTranslateX(-4);
    circle.setTranslateY(-4);
    circle.setOnMouseEntered(evt -> tooltip.setText(location.getName()));
    Tooltip.install(circle, tooltip);
    return circle;
  });
}

代码示例来源:origin: PhoenicisOrg/phoenicis

/**
 * Creates a region with the miniature of the list element
 *
 * @return A region with the miniature of the list element
 */
private Region createMiniature() {
  final Region miniature = new Region();
  miniature.getStyleClass().add("iconListMiniatureImage");
  miniature.styleProperty().bind(
      Bindings.createStringBinding(
          () -> String.format("-fx-background-image: url(\"%s\");",
              getControl().getMiniatureUri().toString()),
          getControl().miniatureUriProperty()));
  final Tooltip tooltip = new Tooltip();
  tooltip.textProperty().bind(getControl().titleProperty());
  Tooltip.install(miniature, tooltip);
  // set a gray filter for this element if it is not enabled
  getControl().enabledProperty().addListener((Observable invalidation) -> updateEnabled(miniature));
  // adopt the enable status during initialisation
  updateEnabled(miniature);
  return miniature;
}

代码示例来源:origin: nl.cloudfarming.client/calendar-api

public Bar(CalendarNode node, String seriesStyleClass, String dataStyleClass, int depth) {
  this.node = node;
  this.depth = depth;
  this.seriesStyleClass = seriesStyleClass;
  this.dataStyleClass = dataStyleClass;
  setAutoSizeChildren(false);
  bar = new RegionWithTitle(node.getName());
  getChildren().addAll(bar);
  updateStyleClasses();
  tooltip = new Tooltip();
  tooltip.setGraphic(new TooltipContent());
  Tooltip.install(bar, tooltip);
  setCursor(javafx.scene.Cursor.HAND);
  initListeners();
}

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

Tooltip.install(this, new Tooltip((tooltipStr == null) ? "" : tooltipStr.toUpperCase()));

代码示例来源:origin: com.github.almasb/fxgl-base

/**
 * @return menu content containing a list of achievements
 */
protected final MenuContent createContentAchievements() {
  log.debug("createContentAchievements()");
  MenuContent content = new MenuContent();
  for (Achievement a : app.getGameplay().getAchievementManager().getAchievements()) {
    CheckBox checkBox = new CheckBox();
    checkBox.setDisable(true);
    checkBox.selectedProperty().bind(a.achievedProperty());
    Text text = getUIFactory().newText(a.getName());
    Tooltip.install(text, new Tooltip(a.getDescription()));
    HBox box = new HBox(25, text, checkBox);
    box.setAlignment(Pos.CENTER_RIGHT);
    content.getChildren().add(box);
  }
  return content;
}

代码示例来源:origin: com.speedment.tool/tool-propertyeditor

final Tooltip tooltip = new Tooltip(tooltipText);
Tooltip.install(pane, tooltip);
menu.getItems().add(item);

代码示例来源:origin: com.powsybl/powsybl-gse-network-explorer

Tooltip tooltipVoltageLevel1 = new Tooltip();
tooltipVoltageLevel1.textProperty().bind(this.voltageLevel1);
Tooltip.install(voltageLevel1Text, tooltipVoltageLevel1);
Tooltip tooltipVoltageLevel2 = new Tooltip();
tooltipVoltageLevel2.textProperty().bind(this.voltageLevel2);
Tooltip.install(voltageLevel2Text, tooltipVoltageLevel2);

代码示例来源:origin: PhoenicisOrg/phoenicis

/**
 * Refreshes the shown scripts.
 * When this method is called it begins by clearing the <code>scriptGrid</code>.
 * Afterwards this method refills it.
 */
private void updateScripts(final GridPane scriptGrid) {
  scriptGrid.getChildren().clear();
  for (int i = 0; i < filteredScripts.size(); i++) {
    ScriptDTO script = filteredScripts.get(i);
    final Label scriptName = new Label(script.getScriptName());
    GridPane.setHgrow(scriptName, Priority.ALWAYS);
    if (getControl().isShowScriptSource()) {
      final Tooltip tooltip = new Tooltip(tr("Source: {0}", script.getScriptSource()));
      Tooltip.install(scriptName, tooltip);
    }
    final Button installButton = new Button(tr("Install"));
    installButton.setOnMouseClicked(evt -> {
      try {
        installScript(script);
      } catch (IllegalArgumentException e) {
        final ErrorDialog errorDialog = ErrorDialog.builder()
            .withMessage(tr("Error while trying to download the installer"))
            .withException(e)
            .build();
        errorDialog.showAndWait();
      }
    });
    scriptGrid.addRow(i, scriptName, installButton);
  }
}

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

Tooltip.install(this, tooltip);
oldTooltip = tooltip;
  Tooltip.install(this, tooltip);
  oldTooltip = tooltip;

相关文章