當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。