GraphicsApp API
Eine überarbeitete und angepasste Variante der originalen GraphicsApp-Umgebung
Point.java
gehe zur Dokumentation dieser Datei
1
package
de.ur.mi.oop.graphics;
2
3
/**
4
* Die Punktklasse repräsentiert einen Punkt auf der Zeichenfläche.
5
*/
6
public
class
Point
{
7
private
float
x;
8
private
float
y;
9
10
/**
11
* Erzeugt einen neuen Point bei (0, 0).
12
*/
13
public
Point
() {
14
this.x = 0.0f;
15
this.y = 0.0f;
16
}
17
18
/**
19
* Erzeugt einen neuen Point bei (x, y).
20
*
21
* @param x die x-Koordinate des Punktes
22
* @param y die y-Koordinate des Punktes
23
*/
24
public
Point
(
float
x,
float
y) {
25
this.x = x;
26
this.y = y;
27
}
28
29
public
float
getXPos
() {
30
return
this.x;
31
}
32
33
public
float
getYPos
() {
34
return
this.y;
35
}
36
37
public
Point
getPosition
() {
38
return
new
Point
(this.x, this.y);
39
}
40
41
/**
42
* Setzt die Position des Punktes auf die angegebene Position.
43
*
44
* @param x Die x-Position des Punktes
45
* @param y y
46
* Die y-Position des Punktes
47
*/
48
public
void
setLocation
(
float
x,
float
y) {
49
this.x = x;
50
this.y = y;
51
}
52
53
/**
54
* Bewegt den Punkt auf dem Bildschirm mit den Verschiebungen dx und dy.
55
*
56
* @param dx Die horizontale Änderung der Position
57
* @param dy Die vertikale Änderung der Position
58
*/
59
public
void
move
(
float
dx,
float
dy) {
60
this.x += dx;
61
this.y += dy;
62
}
63
64
/**
65
* Setzt die Position des Punktes auf die Position eines neuen Punktobjekts.
66
*
67
* @param point Der Punkt, der die neuen Positionsinformationen enthält.
68
*/
69
public
void
setLocation
(
Point
point) {
70
this.x = point.x;
71
this.y = point.y;
72
}
73
}
de.ur.mi.oop.graphics.Point
Definition:
Point.java:6
de.ur.mi.oop.graphics.Point.getYPos
float getYPos()
Definition:
Point.java:33
de.ur.mi.oop.graphics.Point.Point
Point(float x, float y)
Definition:
Point.java:24
de.ur.mi.oop.graphics.Point.setLocation
void setLocation(float x, float y)
Definition:
Point.java:48
de.ur.mi.oop.graphics.Point.getXPos
float getXPos()
Definition:
Point.java:29
de.ur.mi.oop.graphics.Point.getPosition
Point getPosition()
Definition:
Point.java:37
de.ur.mi.oop.graphics.Point.setLocation
void setLocation(Point point)
Definition:
Point.java:69
de.ur.mi.oop.graphics.Point.move
void move(float dx, float dy)
Definition:
Point.java:59
de.ur.mi.oop.graphics.Point.Point
Point()
Definition:
Point.java:13
src
de
ur
mi
oop
graphics
Point.java
Erzeugt am Don Nov 4 2021 11:33:23 für GraphicsApp API von
1.9.2