本文整理汇总了Java中javafx.scene.input.MouseEvent.MOUSE_MOVED属性的典型用法代码示例。如果您正苦于以下问题:Java MouseEvent.MOUSE_MOVED属性的具体用法?Java MouseEvent.MOUSE_MOVED怎么用?Java MouseEvent.MOUSE_MOVED使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类javafx.scene.input.MouseEvent
的用法示例。
在下文中一共展示了MouseEvent.MOUSE_MOVED属性的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: handle
@Override
public void handle(MouseEvent event) {
if(event.getEventType()==MouseEvent.MOUSE_MOVED){
move.handle(event.getX(),event.getY());
}else if(event.getEventType()==MouseEvent.MOUSE_PRESSED){
if(event.getButton()==MouseButton.PRIMARY){
press.handle(event.getX(),event.getY());
}else if(event.getButton()==MouseButton.SECONDARY){
rightPress.handle(event.getX(),event.getY());
}
}else if(event.getEventType()==MouseEvent.MOUSE_RELEASED){
if(event.getButton()==MouseButton.PRIMARY){
release.handle(event.getX(),event.getY());
}else if(event.getButton()==MouseButton.SECONDARY){
rightRelease.handle(event.getX(),event.getY());
}
}
}
示例2: HorizonChart
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();
}
示例3: moveto
@Override public void moveto(Node node, double xoffset, double yoffset) {
MouseButton buttons = deviceState.getButtons();
if (node != deviceState.getNode()) {
if (deviceState.getNode() != null) {
dispatchEvent(createMouseEvent(MouseEvent.MOUSE_PRESSED, null, null, xoffset, yoffset, 0, 0, buttons, 0,
deviceState.shiftPressed, deviceState.ctrlPressed, deviceState.altPressed, deviceState.metaPressed,
buttons == MouseButton.PRIMARY, buttons == MouseButton.MIDDLE, buttons == MouseButton.SECONDARY, false,
false, false, node));
}
dispatchEvent(createMouseEvent(MouseEvent.MOUSE_ENTERED, null, null, xoffset, yoffset, 0, 0, buttons, 0,
deviceState.shiftPressed, deviceState.ctrlPressed, deviceState.altPressed, deviceState.metaPressed,
buttons == MouseButton.PRIMARY, buttons == MouseButton.MIDDLE, buttons == MouseButton.SECONDARY, false, false,
false, node));
}
Node source = node;
EventType<MouseEvent> id = MouseEvent.MOUSE_MOVED;
if (buttons != MouseButton.NONE) {
id = MouseEvent.MOUSE_DRAGGED;
source = deviceState.getDragSource();
}
MouseButton modifierEx = deviceState.getButtonMask();
dispatchEvent(createMouseEvent(id, null, null, xoffset, yoffset, 0, 0, buttons, 0, deviceState.shiftPressed,
deviceState.ctrlPressed, deviceState.altPressed, deviceState.metaPressed, modifierEx == MouseButton.PRIMARY,
modifierEx == MouseButton.MIDDLE, modifierEx == MouseButton.SECONDARY, false, false, false, source));
deviceState.setNode(node);
deviceState.setMousePosition(xoffset, yoffset);
}
示例4: 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();
}
示例5: 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);
}
示例6: 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);
}
}
};
}
示例7: 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?
}
}
};
}