v0.3.2: added ability to customize the button text for the new notification window
This commit is contained in:
parent
ca4f25fe49
commit
6cfb967ab4
|
@ -12,17 +12,19 @@ public class WndHardNotification extends WndTitledMessage{
|
||||||
RedButton btnOkay;
|
RedButton btnOkay;
|
||||||
|
|
||||||
private double timeLeft;
|
private double timeLeft;
|
||||||
|
private String btnMessage;
|
||||||
|
|
||||||
public WndHardNotification( Image icon, String title, String message, int time) {
|
public WndHardNotification( Image icon, String title, String message, String btnMessage, int time) {
|
||||||
this(new IconTitle(icon, title), message, time);
|
this(new IconTitle(icon, title), message, btnMessage, time);
|
||||||
}
|
}
|
||||||
|
|
||||||
public WndHardNotification(Component titlebar, String message, int time) {
|
public WndHardNotification(Component titlebar, String message, String btnMessage, int time) {
|
||||||
super(titlebar, message);
|
super(titlebar, message);
|
||||||
|
|
||||||
timeLeft = time;
|
timeLeft = time;
|
||||||
|
this.btnMessage = btnMessage;
|
||||||
|
|
||||||
btnOkay = new RedButton("Okay (" + time +")"){
|
btnOkay = new RedButton(btnMessage + " (" + time +")"){
|
||||||
@Override
|
@Override
|
||||||
protected void onClick() {
|
protected void onClick() {
|
||||||
hide();
|
hide();
|
||||||
|
@ -42,9 +44,9 @@ public class WndHardNotification extends WndTitledMessage{
|
||||||
timeLeft -= Game.elapsed;
|
timeLeft -= Game.elapsed;
|
||||||
if (timeLeft <= 0 ){
|
if (timeLeft <= 0 ){
|
||||||
btnOkay.enable(true);
|
btnOkay.enable(true);
|
||||||
btnOkay.text("Okay");
|
btnOkay.text(btnMessage);
|
||||||
} else {
|
} else {
|
||||||
btnOkay.text("Okay (" + (int)Math.ceil(timeLeft) + ")");
|
btnOkay.text(btnMessage + " (" + (int)Math.ceil(timeLeft) + ")");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user