GraphicsApp API
Eine überarbeitete und angepasste Variante der originalen GraphicsApp-Umgebung
GraphicsAppMouseEvent.java
gehe zur Dokumentation dieser Datei
1
package
de.ur.mi.oop.events;
2
3
import
java.awt.event.MouseEvent;
4
5
public
abstract
class
GraphicsAppMouseEvent
extends
Event
{
6
7
private
final
int
xPos;
8
private
final
int
yPos;
9
private
final
MouseEventType
type;
10
11
public
GraphicsAppMouseEvent
(
long
timestamp
,
int
xPos,
int
yPos,
MouseEventType
type) {
12
super(
timestamp
);
13
this.xPos = xPos;
14
this.yPos = yPos;
15
this.type = type;
16
}
17
18
public
MouseEventType
getType
() {
19
return
this.type;
20
}
21
22
public
int
getXPos
() {
23
return
this.xPos;
24
}
25
26
public
int
getYPos
() {
27
return
this.yPos;
28
}
29
30
public
static
GraphicsAppMouseEvent
createMouseEventFromAWT
(MouseEvent event,
MouseEventType
type) {
31
long
timestamp
= System.currentTimeMillis();
32
int
xPos =
event
.getX();
33
int
yPos =
event
.getY();
34
MouseButton
button =
MouseButton
.values()[
event
.getButton()];
35
switch
(type) {
36
case
PRESSED:
37
return
new
MousePressedEvent
(
timestamp
, xPos, yPos, button);
38
case
RELEASED:
39
return
new
MouseReleasedEvent
(
timestamp
, xPos, yPos, button);
40
case
MOVED:
41
return
new
MouseMovedEvent
(
timestamp
, xPos, yPos);
42
case
DRAGGED:
43
return
new
MouseDraggedEvent
(
timestamp
, xPos, yPos);
44
default
:
45
return
null
;
46
}
47
}
48
49
}
de.ur.mi.oop.events.Event
Definition:
Event.java:6
de.ur.mi.oop.events.Event.timestamp
final long timestamp
Definition:
Event.java:8
de.ur.mi.oop.events.GraphicsAppMouseEvent
Definition:
GraphicsAppMouseEvent.java:5
de.ur.mi.oop.events.GraphicsAppMouseEvent.createMouseEventFromAWT
static GraphicsAppMouseEvent createMouseEventFromAWT(MouseEvent event, MouseEventType type)
Definition:
GraphicsAppMouseEvent.java:30
de.ur.mi.oop.events.GraphicsAppMouseEvent.GraphicsAppMouseEvent
GraphicsAppMouseEvent(long timestamp, int xPos, int yPos, MouseEventType type)
Definition:
GraphicsAppMouseEvent.java:11
de.ur.mi.oop.events.GraphicsAppMouseEvent.getType
MouseEventType getType()
Definition:
GraphicsAppMouseEvent.java:18
de.ur.mi.oop.events.GraphicsAppMouseEvent.getYPos
int getYPos()
Definition:
GraphicsAppMouseEvent.java:26
de.ur.mi.oop.events.GraphicsAppMouseEvent.getXPos
int getXPos()
Definition:
GraphicsAppMouseEvent.java:22
de.ur.mi.oop.events.MouseDraggedEvent
Definition:
MouseDraggedEvent.java:3
de.ur.mi.oop.events.MouseMovedEvent
Definition:
MouseMovedEvent.java:4
de.ur.mi.oop.events.MousePressedEvent
Definition:
MousePressedEvent.java:3
de.ur.mi.oop.events.MouseReleasedEvent
Definition:
MouseReleasedEvent.java:3
de.ur.mi.oop.events.MouseButton
Definition:
MouseButton.java:3
de.ur.mi.oop.events.MouseEventType
Definition:
MouseEventType.java:3
src
de
ur
mi
oop
events
GraphicsAppMouseEvent.java
Erzeugt am Don Nov 4 2021 11:33:23 für GraphicsApp API von
1.9.2