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


Java Event.getEventType方法代碼示例

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


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

示例1: handle

import javafx.event.Event; //導入方法依賴的package包/類
@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,代碼行數:18,代碼來源:WhereIsIt.java

示例2: notifyImpl

import javafx.event.Event; //導入方法依賴的package包/類
/**
 * The process of handling a new event.
 */
@FXThread
private void notifyImpl(@NotNull final Event event) {

    final ObjectDictionary<EventType<? extends Event>, Array<EventHandler<? super Event>>> eventHandlers = getEventHandlers();

    for (EventType<? extends Event> eventType = event.getEventType();
         eventType != null; eventType = eventType.getSuperType()) {

        final Array<EventHandler<? super Event>> handlers = eventHandlers.get(eventType);
        if (handlers == null || handlers.isEmpty()) continue;

        handlers.forEach(event, EventHandler::handle);
    }

    if (event instanceof ConsumableEvent && !event.isConsumed()) {
        final ExecutorManager executorManager = ExecutorManager.getInstance();
        executorManager.addFXTask(() -> notifyImpl(event));
    }
}
 
開發者ID:JavaSaBr,項目名稱:jmonkeybuilder,代碼行數:23,代碼來源:FXEventManager.java

示例3: handleRawRecording

import javafx.event.Event; //導入方法依賴的package包/類
public void handleRawRecording(IJSONRecorder recorder, Event event) {
    if (event instanceof MouseEvent && event.getEventType() == MouseEvent.MOUSE_PRESSED) {
        recorder.recordRawMouseEvent(this, (MouseEvent) event);
    }
    if (event instanceof KeyEvent && event.getEventType() != KeyEvent.KEY_RELEASED) {
        recorder.recordRawKeyEvent(this, (KeyEvent) event);
    }
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:9,代碼來源:RFXComponent.java

示例4: buildEvent

import javafx.event.Event; //導入方法依賴的package包/類
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,代碼行數:76,代碼來源:Card.java

示例5: buildEvent

import javafx.event.Event; //導入方法依賴的package包/類
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,代碼行數:41,代碼來源:Circles_handler.java

示例6: buildEvent

import javafx.event.Event; //導入方法依賴的package包/類
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,代碼行數:40,代碼來源:HeatMap.java

示例7: buildBravoEvent

import javafx.event.Event; //導入方法依賴的package包/類
private  EventHandler<Event> buildBravoEvent() {
    return new EventHandler<Event>() {
        @Override
        public void handle(Event e) {



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

                canvas.getChildren().removeAll(imgViewTriangle, imgViewSquare, imgViewTrapez);
                canvas.add(imgViewBravo, 3, 3);

                String musicFileBravo = "samplesAmela/sounds/applause.mp3";

                Media soundBravo = new Media(new File(musicFileBravo).toURI().toString());
                MediaPlayer mediaPlayerBravo = new MediaPlayer(soundBravo);
                mediaPlayerBravo.play();

                System.out.println("Image 1 Clicked! BRAVO!");

                Animation animation = new Transition() {

                    {
                        setCycleDuration(Duration.millis(5000));
                        canvas.getChildren().add(bubble);


                    }

                    @Override
                    protected void interpolate(double frac) {
                        final int n = Math.round(100 * (float) frac);

                    }

                };
                animation.play();
                animation.setOnFinished(new EventHandler<ActionEvent>() {


                    @Override
                    public void handle(ActionEvent actionEvent) {
                        canvas.getChildren().remove(imgViewBravo);
                        canvas.getChildren().remove(bubble);

                        count=0;
                        Image image = canvas.snapshot(new SnapshotParameters(), null);
                        ImagePattern pattern = new ImagePattern(image, 0, 0, 0, 0, false);
                        pattern=createGridPattern();
                    }
                });

            }

        }
    };

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

示例8: createAnimation

import javafx.event.Event; //導入方法依賴的package包/類
private  EventHandler<Event> createAnimation() {
    return new EventHandler<Event>() {
        @Override
        public void handle(Event e) {



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

                System.out.println("Image Clicked! BRAVO!");

                Animation animation = new Transition() {

                    {
                        setCycleDuration(Duration.millis(3000));
                        hboxFirst.getChildren().removeAll(imgView1, imgView2, imgView3);
                        hboxFirst.getChildren().add(imgView4);
                        String musicFileBravo =  System.getProperties().getProperty("user.home") + File.separator + "GazePlay" + File.separator + "files" + File.separator + "myGame"+File.separator+"applause.mp3";
                        File fSound = new File(musicFileBravo);

                        Media firstSound = new Media(fSound.toURI().toString());
                        MediaPlayer mediaPlayerBravo = new MediaPlayer(firstSound);
                        mediaPlayerBravo.play();
                    }

                    @Override
                    protected void interpolate(double frac) {
                        final int n = Math.round(3000 * (float) frac);

                    }
                };

                animation.play();

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


                    @Override
                    public void handle(ActionEvent actionEvent) {
                        hboxFirst.getChildren().removeAll(imgView4);
                        createGame(sceneFirst, hboxFirst);

                    }
                });

            }

        }
    };

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


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