本文整理汇总了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();
}
}
示例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));
}
}
示例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);
}
}
示例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);
}
}
};
}
示例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);
}
}
};
}
示例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?
}
}
};
}
示例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();
}
});
}
}
};
}
示例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);
}
});
}
}
};
}