当前位置: 首页>>代码示例>>Java>>正文


Java Tooltip.show方法代码示例

本文整理汇总了Java中javafx.scene.control.Tooltip.show方法的典型用法代码示例。如果您正苦于以下问题:Java Tooltip.show方法的具体用法?Java Tooltip.show怎么用?Java Tooltip.show使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javafx.scene.control.Tooltip的用法示例。


在下文中一共展示了Tooltip.show方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: showTooltip

import javafx.scene.control.Tooltip; //导入方法依赖的package包/类
public void showTooltip(boolean beginning) {
    generateTooltip();
    Tooltip tt = requireNonNull(fTooltip);

    /*
     * Show the tooltip first, then move it to the correct location. It
     * needs to be shown for its getWidth() etc. to be populated.
     */
    tt.show(this, 0, 0);

    Point2D position;
    if (beginning) {
        /* Align to the bottom-left of the rectangle, left-aligned. */
        /* Yes, it needs to be getX() here (0), not getLayoutX(). */
        position = this.localToScreen(getX(), getY() + getHeight());
    } else {
        /* Align to the bottom-right of the rectangle, right-aligned */
        position = this.localToScreen(getX() + getWidth() - tt.getWidth(), getY() + getHeight());
    }

    tt.setAnchorX(position.getX());
    tt.setAnchorY(position.getY());
}
 
开发者ID:lttng,项目名称:lttng-scope,代码行数:24,代码来源:StateRectangle.java

示例2: HorizonChart

import javafx.scene.control.Tooltip; //导入方法依赖的package包/类
public HorizonChart(final int BANDS, final Series<T> SERIES, final boolean SMOOTHED) {
    series        = SERIES;
    scaleX        = 1;
    scaleY        = 1;
    smoothed      = SMOOTHED;
    referenceZero = true;
    noOfBands     = clamp(1, MAX_NO_OF_BANDS, BANDS);
    noOfItems     = SERIES.getNoOfItems();
    minY          = SERIES.getItems().stream().mapToDouble(Data::getY).min().getAsDouble();
    maxY          = SERIES.getItems().stream().mapToDouble(Data::getY).max().getAsDouble();
    bandWidth     = (maxY - minY) / noOfBands;
    tooltip       = new Tooltip();
    tooltip.setAnchorLocation(AnchorLocation.CONTENT_BOTTOM_LEFT);

    adjustColors();

    // Create list of points
    points = new ArrayList<>(noOfItems);
    prepareData();

    mouseListener           = mouseEvent -> {
        final EventType<? extends MouseEvent> TYPE = mouseEvent.getEventType();
        if (MouseEvent.MOUSE_CLICKED == TYPE) {
            Data<T> data = selectDataAt(mouseEvent.getX());
            tooltip.setText(createTooltipText(data));
            tooltip.setX(mouseEvent.getScreenX());
            tooltip.setY(mouseEvent.getScreenY());
            tooltip.show(getScene().getWindow());
            getSeries().fireSeriesEvent(new SeriesEvent(getSeries(), data, SeriesEventType.SELECT_DATA));
        } else if (MouseEvent.MOUSE_MOVED == TYPE) {
            tooltip.hide();
        } else if (MouseEvent.MOUSE_EXITED == TYPE) {
            tooltip.hide();
        }
    };
    seriesListener          = seriesEvent -> redraw();

    initGraphics();
    registerListeners();
}
 
开发者ID:HanSolo,项目名称:horizon,代码行数:41,代码来源:HorizonChart.java

示例3: showHelpStatement

import javafx.scene.control.Tooltip; //导入方法依赖的package包/类
private void showHelpStatement () {
    Tooltip help = new Tooltip(myLanguage.getString("CondHelp"));
    help.show(myView.getEditor(), getPoint().getX(), getPoint().getY());
    myView.getEditor().setOnMouseExited(e -> help.hide());
}
 
开发者ID:tomrom95,项目名称:GameAuthoringEnvironment,代码行数:6,代码来源:ConditionController.java


注:本文中的javafx.scene.control.Tooltip.show方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。