EOS 2
1.1.0
Einfache Objektbasierte Sprache
Eos
src
de
lathanda
eos
gui
diagram
TextUnit.java
gehe zur Dokumentation dieser Datei
1
package
de.lathanda.eos.gui.diagram;
2
3
public
class
TextUnit
extends
Unit
{
4
private
String text;
5
private
float
x;
6
private
float
y;
7
private
float
textheight;
8
private
float
textwidth;
9
private
float
ascent;
10
11
public
TextUnit
(String text) {
12
super();
13
if
(text !=
null
) {
14
this.text = text;
15
}
else
{
16
this.text =
"\uFFFD"
;
17
}
18
}
19
20
@Override
21
public
void
drawUnit
(
Drawing
d) {
22
d.
drawString
(text, x, y);
23
}
24
25
@Override
26
public
void
layoutUnit
(
Drawing
d) {
27
textheight = d.
getHeight
();
28
textwidth = d.
stringWidth
(text);
29
ascent = d.
getAscent
();
30
height
= textheight;
31
width
= textwidth;
32
y = ascent;
33
x = 0;
34
}
35
36
public
void
alignCentralX
() {
37
x = (
width
- textwidth) / 2;
38
}
39
40
public
void
alignLeft
() {
41
x = 0;
42
}
43
44
public
void
alignRight
() {
45
x =
width
- textwidth;
46
}
47
48
public
void
allignCentralY
() {
49
y = (
height
- textheight) / 2 + ascent;
50
}
51
52
public
void
alignTop
() {
53
y = ascent;
54
}
55
56
public
void
alignBottom
() {
57
y =
height
- textheight + ascent;
58
}
59
}
de.lathanda.eos.gui.diagram.Drawing
Definition:
Drawing.java:22
de.lathanda.eos.gui.diagram.Drawing.getAscent
float getAscent()
Definition:
Drawing.java:119
de.lathanda.eos.gui.diagram.Drawing.stringWidth
float stringWidth(String text)
Definition:
Drawing.java:111
de.lathanda.eos.gui.diagram.Drawing.getHeight
float getHeight()
Definition:
Drawing.java:127
de.lathanda.eos.gui.diagram.Drawing.drawString
void drawString(String text, float x, float y)
Definition:
Drawing.java:148
de.lathanda.eos.gui.diagram.TextUnit
Definition:
TextUnit.java:3
de.lathanda.eos.gui.diagram.TextUnit.alignTop
void alignTop()
Definition:
TextUnit.java:52
de.lathanda.eos.gui.diagram.TextUnit.alignBottom
void alignBottom()
Definition:
TextUnit.java:56
de.lathanda.eos.gui.diagram.TextUnit.TextUnit
TextUnit(String text)
Definition:
TextUnit.java:11
de.lathanda.eos.gui.diagram.TextUnit.drawUnit
void drawUnit(Drawing d)
Definition:
TextUnit.java:21
de.lathanda.eos.gui.diagram.TextUnit.allignCentralY
void allignCentralY()
Definition:
TextUnit.java:48
de.lathanda.eos.gui.diagram.TextUnit.alignLeft
void alignLeft()
Definition:
TextUnit.java:40
de.lathanda.eos.gui.diagram.TextUnit.alignRight
void alignRight()
Definition:
TextUnit.java:44
de.lathanda.eos.gui.diagram.TextUnit.alignCentralX
void alignCentralX()
Definition:
TextUnit.java:36
de.lathanda.eos.gui.diagram.TextUnit.layoutUnit
void layoutUnit(Drawing d)
Definition:
TextUnit.java:26
de.lathanda.eos.gui.diagram.Unit
Definition:
Unit.java:11
de.lathanda.eos.gui.diagram.Unit.height
float height
Definition:
Unit.java:19
de.lathanda.eos.gui.diagram.Unit.width
float width
Definition:
Unit.java:18
Impressum