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


Java MouseEvent.MOUSE_ENTERED屬性代碼示例

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


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

示例1: buildEvent

private EventHandler<Event> buildEvent() {

        return e -> {

            // if((e.getEventType() == MouseEvent.MOUSE_ENTERED_TARGET ||e.getEventType() == MouseEvent.MOUSE_ENTERED ||
            // e.getEventType() == MouseEvent.MOUSE_MOVED || e.getEventType() == GazeEvent.GAZE_ENTERED ||
            // e.getEventType() == GazeEvent.GAZE_MOVED) && anniOff) {

            if (animationStopped
                    && (e.getEventType() == MouseEvent.MOUSE_ENTERED || e.getEventType() == GazeEvent.GAZE_ENTERED)) {

                animationStopped = false;
                enter(e);
            }
        };
    }
 
開發者ID:schwabdidier,項目名稱:GazePlay,代碼行數:16,代碼來源:Target.java

示例2: handle

@Override
public void handle(Event e) {
    if (ignoreAnyInput) {
        return;
    }

    if (selected) {
        return;
    }

    if (e.getEventType() == MouseEvent.MOUSE_ENTERED || e.getEventType() == GazeEvent.GAZE_ENTERED) {
        onEntered();
    } else if (e.getEventType() == MouseEvent.MOUSE_EXITED || e.getEventType() == GazeEvent.GAZE_EXITED) {
        onExited();
    }

}
 
開發者ID:schwabdidier,項目名稱:GazePlay,代碼行數:17,代碼來源:WhereIsIt.java

示例3: Bubble

public Bubble(Scene scene) {

        this.scene = scene;

        enterEvent = new EventHandler<Event>() {
            @Override
            public void handle(Event e) {

               // System.out.println(e.getEventType() + " " + e.getTarget());
                if (e.getEventType() == MouseEvent.MOUSE_ENTERED || e.getEventType() == GazeEvent.GAZE_ENTERED) {

                    //System.out.println(e.getEventType());
                    enter((Circle) e.getTarget());
                }
            }
        };

        for (int i = 0; i < 20; i++) {

            newCircle();
        }
    }
 
開發者ID:schwabdidier,項目名稱:GazePlay,代碼行數:22,代碼來源:Bubble.java

示例4: buildEvent

private EventHandler<Event> buildEvent() {
    return new EventHandler<Event>() {
        @Override
        public void handle(Event e) {

            if (turned)
                return;

            if (e.getEventType() == MouseEvent.MOUSE_ENTERED || e.getEventType() == GazeEvent.GAZE_ENTERED) {

                progressIndicator.setOpacity(1);
                progressIndicator.setProgress(0);

                Timeline timelineCard = new Timeline();

                timelineCard.getKeyFrames().add(new KeyFrame(new Duration(1),
                        new KeyValue(card.xProperty(), card.getX() - (initWidth * zoom_factor - initWidth) / 2)));
                timelineCard.getKeyFrames().add(new KeyFrame(new Duration(1),
                        new KeyValue(card.yProperty(), card.getY() - (initHeight * zoom_factor - initHeight) / 2)));
                timelineCard.getKeyFrames().add(
                        new KeyFrame(new Duration(1), new KeyValue(card.widthProperty(), initWidth * zoom_factor)));
                timelineCard.getKeyFrames().add(new KeyFrame(new Duration(1),
                        new KeyValue(card.heightProperty(), initHeight * zoom_factor)));

                timelineProgressBar = new Timeline();

                timelineProgressBar.getKeyFrames().add(new KeyFrame(new Duration(fixationlength),
                        new KeyValue(progressIndicator.progressProperty(), 1)));

                timelineCard.play();

                timelineProgressBar.play();

                timelineProgressBar.setOnFinished(new EventHandler<ActionEvent>() {

                    @Override
                    public void handle(ActionEvent actionEvent) {

                        turned = true;

                        card.setFill(new ImagePattern(image, 0, 0, 1, 1, true));

                        card.removeEventFilter(MouseEvent.ANY, enterEvent);
                        card.removeEventFilter(GazeEvent.ANY, enterEvent);

                        if (winner) {
                            onCorrectCardSelected();
                        } else {// bad card
                            onWrongCardSelected();
                        }
                    }
                });
            } else if (e.getEventType() == MouseEvent.MOUSE_EXITED || e.getEventType() == GazeEvent.GAZE_EXITED) {

                Timeline timeline = new Timeline();

                timeline.getKeyFrames().add(new KeyFrame(new Duration(1),
                        new KeyValue(card.xProperty(), card.getX() + (initWidth * zoom_factor - initWidth) / 2)));
                timeline.getKeyFrames().add(new KeyFrame(new Duration(1),
                        new KeyValue(card.yProperty(), card.getY() + (initHeight * zoom_factor - initHeight) / 2)));
                timeline.getKeyFrames()
                        .add(new KeyFrame(new Duration(1), new KeyValue(card.widthProperty(), initWidth)));
                timeline.getKeyFrames()
                        .add(new KeyFrame(new Duration(1), new KeyValue(card.heightProperty(), initHeight)));

                timeline.play();

                timelineProgressBar.stop();

                progressIndicator.setOpacity(0);
                progressIndicator.setProgress(0);
            }
        }
    };
}
 
開發者ID:schwabdidier,項目名稱:GazePlay,代碼行數:75,代碼來源:Card.java

示例5: Target

public Target(RandomPositionGenerator randomPositionGenerator, Hand hand, Stats stats, Image[] availableImages) {

        super(radius, randomPositionGenerator, availableImages);

        this.randomPositionGenerator = randomPositionGenerator;
        this.hand = hand;
        this.availableImages = availableImages;
        this.stats = stats;

        enterEvent = new EventHandler<Event>() {
            @Override
            public void handle(Event e) {

                if ((e.getEventType() == MouseEvent.MOUSE_ENTERED || e.getEventType() == MouseEvent.MOUSE_MOVED
                        || e.getEventType() == GazeEvent.GAZE_ENTERED || e.getEventType() == GazeEvent.GAZE_MOVED)
                        && anniOff) {

                    anniOff = false;
                    stats.incNbGoals();
                    enter();
                }
            }
        };

        GazeUtils.addEventFilter(this);

        this.addEventFilter(MouseEvent.ANY, enterEvent);

        this.addEventFilter(GazeEvent.ANY, enterEvent);

        stats.start();
    }
 
開發者ID:schwabdidier,項目名稱:GazePlay,代碼行數:32,代碼來源:Target.java

示例6: Bubble

public Bubble(GameContext gameContext, BubbleType type, Stats stats, boolean useBackgroundImage) {
    this.gameContext = gameContext;
    this.type = type;
    this.stats = stats;
    this.image = useBackgroundImage;

    photos = Utils.images(Utils.getImagesFolder() + "portraits" + Utils.FILESEPARATOR);

    if (useBackgroundImage) {
        gameContext.getScene().setFill(new ImagePattern(new Image("data/bubble/images/underwater-treasures.jpg")));
    }

    gameContext.getChildren().add(this);

    this.fragments = buildFragments(type);

    this.getChildren().addAll(fragments);

    enterEvent = new EventHandler<Event>() {
        @Override
        public void handle(Event e) {

            if (e.getEventType() == MouseEvent.MOUSE_ENTERED || e.getEventType() == GazeEvent.GAZE_ENTERED) {

                // log.info(e.getEventType());
                enter((Circle) e.getTarget());
                stats.incNbGoals();
                stats.start();
            }
        }
    };

}
 
開發者ID:schwabdidier,項目名稱:GazePlay,代碼行數:33,代碼來源:Bubble.java

示例7: Lighting

public Lighting(int x, int y, int pixelWidth, int lightingLength, Color lightingColor) {

        X = x;
        Y = y;
        this.lightingLength = lightingLength * 1000;
        this.lightingColor = lightingColor;
        pixel = new Rectangle(x, y, pixelWidth, pixelWidth);
        // pixel.setFill(new Color(Math.random(), Math.random(), Math.random(), 1));
        pixel.setFill(Color.BLACK);
        this.getChildren().add(pixel);

        enterEvent = new EventHandler<Event>() {
            @Override
            public void handle(Event e) {

                if ((e.getEventType() == MouseEvent.MOUSE_ENTERED || e.getEventType() == MouseEvent.MOUSE_MOVED
                        || e.getEventType() == GazeEvent.GAZE_ENTERED || e.getEventType() == GazeEvent.GAZE_MOVED)) {

                    enter();
                }
            }
        };

        this.addEventFilter(MouseEvent.ANY, enterEvent);

        this.addEventHandler(GazeEvent.ANY, enterEvent);

    }
 
開發者ID:schwabdidier,項目名稱:GazePlay,代碼行數:28,代碼來源:Lighting.java

示例8: buildEvent

private  EventHandler<Event> buildEvent() {
    return new EventHandler<Event>() {
        @Override
        public void handle(Event e) {



            if (e.getEventType() == MouseEvent.MOUSE_ENTERED || e.getEventType() == GazeEvent.GAZE_ENTERED) {

                System.out.println("I eggcited");
                entry = (new Date()).getTime();
                indicator.setVisible(true);
                indicator.setOpacity(1);
                circle.setOpacity(0.5);

            }
            else if (e.getEventType() == MouseEvent.MOUSE_MOVED || e.getEventType() == GazeEvent.GAZE_MOVED) {

                System.out.println("I moved");
                indicator.setVisible(true);
                indicator.setOpacity(1);
                circle.setOpacity(0.5);
                long now = (new Date()).getTime();
                indicator.setProgress((now - entry)/min_time);
                System.out.println((now - entry)/min_time);
                if((now - entry)>min_time && entry != -1){
                    createAnimation();
                }

            } else if (e.getEventType() == MouseEvent.MOUSE_EXITED || e.getEventType() == GazeEvent.GAZE_EXITED) {

                entry = -1;
                indicator.setOpacity(1);
                circle.setOpacity(1);

            }
        }
    };

}
 
開發者ID:schwabdidier,項目名稱:GazePlay,代碼行數:40,代碼來源:Circles_handler.java

示例9: buildEvent

private EventHandler<Event> buildEvent () {

            return new EventHandler<Event>() {


                @Override
                public void handle(Event e) {
                    int row=0, col =0, j=0;
                    Object source = e.getSource();
                    ImageView x = (ImageView)source;
                    int y =Integer.parseInt(x.getId());
                    row =  y/ 13;
                    col =  y% 13;


                    if (e.getEventType() == MouseEvent.MOUSE_ENTERED || e.getEventType() == GazeEvent.GAZE_ENTERED) {

                        System.out.println("I entered");
                        count[row][col]++;
                        //System.out.println("count["+row+"]["+col+"] = "+count[row][col]);

                    } else if (e.getEventType() == MouseEvent.MOUSE_MOVED || e.getEventType() == GazeEvent.GAZE_MOVED) {

                        System.out.println("I moved");
                        count[row][col]++;
                        //System.out.println("count["+row+"]["+col+"] = "+count[row][col]);

                    } else if (e.getEventType() == MouseEvent.MOUSE_EXITED || e.getEventType() == GazeEvent.GAZE_EXITED) {

                        //nothing happens with the count
                        //what to put?

                    }

                }

            };

        }
 
開發者ID:schwabdidier,項目名稱:GazePlay,代碼行數:39,代碼來源:HeatMap.java


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