當前位置: 首頁>>代碼示例>>Java>>正文


Java StackPane.setOnMouseReleased方法代碼示例

本文整理匯總了Java中javafx.scene.layout.StackPane.setOnMouseReleased方法的典型用法代碼示例。如果您正苦於以下問題:Java StackPane.setOnMouseReleased方法的具體用法?Java StackPane.setOnMouseReleased怎麽用?Java StackPane.setOnMouseReleased使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javafx.scene.layout.StackPane的用法示例。


在下文中一共展示了StackPane.setOnMouseReleased方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: ToggleSwitchSkin

import javafx.scene.layout.StackPane; //導入方法依賴的package包/類
/**
 * Constructor for all SkinBase instances.
 *
 * @param control The control for which this Skin should attach to.
 */
protected ToggleSwitchSkin(ToggleSwitch control) {
    super(control);

    thumb = new StackPane();
    thumbArea = new StackPane();
    label = new LabeledText(control);
    labelContainer = new StackPane();

    updateLabel(control);
    getChildren().addAll(labelContainer, thumbArea, thumb);
    labelContainer.getChildren().addAll(label);
    StackPane.setAlignment(label, Pos.CENTER_LEFT);

    thumb.getStyleClass().setAll("thumb");
    thumbArea.getStyleClass().setAll("thumb-area");

    thumbArea.setOnMouseReleased(event -> mousePressedOnToggleSwitch(control));
    thumb.setOnMouseReleased(event -> mousePressedOnToggleSwitch(control));
    control.selectedProperty().addListener((observable, oldValue, newValue) -> {
        if (newValue.booleanValue() != oldValue.booleanValue())
            selectedStateChanged();
    });
}
 
開發者ID:thane98,項目名稱:FEFEditor,代碼行數:29,代碼來源:ToggleSwitchSkin.java

示例2: initialize

import javafx.scene.layout.StackPane; //導入方法依賴的package包/類
private void initialize() {
        thumb = new StackPane();
        thumb.getStyleClass().setAll("thumb");
        track = new StackPane();
        track.getStyleClass().setAll("track");
        fill = new StackPane();
        fill.getStyleClass().setAll("fill");
//        horizontal = getSkinnable().isVertical();

        getChildren().clear();
        getChildren().addAll(track, fill, thumb);
        setShowTickMarks(getSkinnable().isShowTickMarks(), getSkinnable().isShowTickLabels());

        track.setOnMousePressed(me -> mousePressedOnTrack(me));
        track.setOnMouseDragged(me -> mouseDraggedOnTrack(me));
        fill.setOnMousePressed(me -> mousePressedOnTrack(me));
        fill.setOnMouseDragged(me -> mouseDraggedOnTrack(me));

        thumb.setOnMousePressed(me -> {
            getBehavior().thumbPressed(me, 0.0f);
            dragStart = thumb.localToParent(me.getX(), me.getY());
            preDragThumbPos = (getSkinnable().getValue() - getSkinnable().getMin()) /
                    (getSkinnable().getMax() - getSkinnable().getMin());
        });

        thumb.setOnMouseReleased(me -> getBehavior().thumbReleased(me));

        thumb.setOnMouseDragged(me -> {
            Point2D cur = thumb.localToParent(me.getX(), me.getY());
            double dragPos = (getSkinnable().getOrientation() == Orientation.HORIZONTAL) ?
                    cur.getX() - dragStart.getX() : -(cur.getY() - dragStart.getY());
            getBehavior().thumbDragged(me, preDragThumbPos + dragPos / trackLength);
        });
    }
 
開發者ID:thane98,項目名稱:FEFEditor,代碼行數:35,代碼來源:FilledSliderSkin.java


注:本文中的javafx.scene.layout.StackPane.setOnMouseReleased方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。