public class Button extends UiComponent
Modifier and Type | Field | Description |
---|---|---|
private java.awt.event.ActionListener |
actionListener |
|
private double |
cornerRounding |
|
private boolean |
pressed |
|
private java.lang.String |
text |
background, font, foreground, highlighted
Constructor | Description |
---|---|
Button(double x,
double y,
double w,
double h,
java.lang.String text) |
Konstruiert neuen Button.
|
Modifier and Type | Method | Description |
---|---|---|
void |
addActionListener(java.awt.event.ActionListener actionListener) |
Fügt dem Button einen ActionListener hinzu, der aktiviert wird, wenn der Cursor über dem Objekt ist und die linke Maustaste gedrückt wird.
|
double |
getCornerRounding() |
|
java.lang.String |
getText() |
|
void |
render(SimpleGraphics graphics) |
Methode für Render-Code.
|
void |
setCornerRounding(double cornerRounding) |
Setzt die Stärke der Ecken-Rundung.
|
void |
setText(java.lang.String text) |
Setzt den Text dieses Buttons.
|
void |
update(double deltaTime,
InputHandler input) |
Methode für Update-Code.
|
collides, getH, getTexture, getW, getX, getY, isPointInside, move, resize, setH, setLocation, setSize, setTexture, setW, setX, setY
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getBackground, getFont, getForeground, isHighlighted, setBackground, setFont, setForeground
private double cornerRounding
private java.lang.String text
private java.awt.event.ActionListener actionListener
private boolean pressed
public Button(double x, double y, double w, double h, java.lang.String text)
x
- Horizontale Position in Pixelny
- Vertikale Position in Pixelnw
- Horizontale Größe in Pixelnh
- Vertikale Größe in Pixelntext
- Text dieses Buttonspublic void update(double deltaTime, InputHandler input)
Entity
update
in class UiComponent
deltaTime
- Zeit seit dem letzten Update in Sekundeninput
- Schnittstelle für Inputpublic void render(SimpleGraphics graphics)
Entity
render
in class UiComponent
graphics
- Schnittstelle für Renderingpublic double getCornerRounding()
public void setCornerRounding(double cornerRounding)
0
für spitze Ecken.cornerRounding
- Stärke Ecken-Rundungpublic java.lang.String getText()
public void setText(java.lang.String text)
text
- Text dieses Buttonspublic void addActionListener(java.awt.event.ActionListener actionListener)
actionListener
- ActionListener der genutzt werden soll