enchanced optionmenu
This commit is contained in:
@@ -96,16 +96,7 @@ public class TextField extends Component {
|
||||
}
|
||||
|
||||
public void render(Graphics g) {
|
||||
if (lastKey != -1) {
|
||||
if (displayContainer.input.isKeyDown(lastKey)) {
|
||||
if (repeatTimer < System.currentTimeMillis()) {
|
||||
repeatTimer = System.currentTimeMillis() + KEY_REPEAT_INTERVAL;
|
||||
keyPressed(lastKey, lastChar);
|
||||
}
|
||||
} else {
|
||||
lastKey = -1;
|
||||
}
|
||||
}
|
||||
performKeyRepeat();
|
||||
Rectangle oldClip = g.getClip();
|
||||
g.setWorldClip(x,y,width, height);
|
||||
|
||||
@@ -145,6 +136,20 @@ public class TextField extends Component {
|
||||
g.setClip(oldClip);
|
||||
}
|
||||
|
||||
public void performKeyRepeat() {
|
||||
if (lastKey == -1) {
|
||||
return;
|
||||
}
|
||||
if (!displayContainer.input.isKeyDown(lastKey)) {
|
||||
lastKey = -1;
|
||||
return;
|
||||
}
|
||||
if (repeatTimer < System.currentTimeMillis()) {
|
||||
repeatTimer = System.currentTimeMillis() + KEY_REPEAT_INTERVAL;
|
||||
keyPressed(lastKey, lastChar);
|
||||
}
|
||||
}
|
||||
|
||||
public String getText() {
|
||||
return value;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user