forked from External/mage
Transfer timeout counter to clock format (minute:second, for example, 100 -> 01:40)
This commit is contained in:
parent
7d6e9eaadd
commit
b057857485
2 changed files with 45 additions and 8 deletions
|
|
@ -102,12 +102,12 @@ public class DeckEditorPanel extends javax.swing.JPanel {
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
if (--timeout > 0) {
|
if (--timeout > 0) {
|
||||||
setTimeout(Integer.toString(timeout));
|
setTimeout(timeout);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (updateDeckTask != null)
|
if (updateDeckTask != null)
|
||||||
updateDeckTask.cancel(true);
|
updateDeckTask.cancel(true);
|
||||||
setTimeout("0");
|
setTimeout(0);
|
||||||
countdown.stop();
|
countdown.stop();
|
||||||
hideDeckEditor();
|
hideDeckEditor();
|
||||||
}
|
}
|
||||||
|
|
@ -136,7 +136,7 @@ public class DeckEditorPanel extends javax.swing.JPanel {
|
||||||
this.deckArea.showSideboard(false);
|
this.deckArea.showSideboard(false);
|
||||||
countdown.stop();
|
countdown.stop();
|
||||||
this.timeout = time;
|
this.timeout = time;
|
||||||
setTimeout(Integer.toString(timeout));
|
setTimeout(timeout);
|
||||||
if (timeout != 0) {
|
if (timeout != 0) {
|
||||||
countdown.start();
|
countdown.start();
|
||||||
if (updateDeckTask == null || updateDeckTask.isDone()) {
|
if (updateDeckTask == null || updateDeckTask.isDone()) {
|
||||||
|
|
@ -308,7 +308,24 @@ public class DeckEditorPanel extends javax.swing.JPanel {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setTimeout(String text) {
|
//private void setTimeout(String text) {
|
||||||
|
// this.txtTimeRemaining.setText(text);
|
||||||
|
//}
|
||||||
|
|
||||||
|
private void setTimeout(int s){
|
||||||
|
int minute = s/60;
|
||||||
|
int second = s - (minute*60);
|
||||||
|
String text;
|
||||||
|
if(minute < 10){
|
||||||
|
text = "0" + Integer.toString(minute) + ":";
|
||||||
|
}else{
|
||||||
|
text = Integer.toString(minute) + ":";
|
||||||
|
}
|
||||||
|
if(second < 10){
|
||||||
|
text = text + "0" + Integer.toString(second);
|
||||||
|
}else{
|
||||||
|
text = text + Integer.toString(second);
|
||||||
|
}
|
||||||
this.txtTimeRemaining.setText(text);
|
this.txtTimeRemaining.setText(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -78,10 +78,12 @@ public class DraftPanel extends javax.swing.JPanel {
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
if (--timeout > 0) {
|
if (--timeout > 0) {
|
||||||
setTimeout(Integer.toString(timeout));
|
//setTimeout(Integer.toString(timeout));
|
||||||
|
setTimeout(timeout);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
setTimeout("0");
|
//setTimeout("0");
|
||||||
|
setTimeout(0);
|
||||||
countdown.stop();
|
countdown.stop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -132,13 +134,31 @@ public class DraftPanel extends javax.swing.JPanel {
|
||||||
setMessage("Pick a card");
|
setMessage("Pick a card");
|
||||||
countdown.stop();
|
countdown.stop();
|
||||||
this.timeout = draftPickView.getTimeout();
|
this.timeout = draftPickView.getTimeout();
|
||||||
setTimeout(Integer.toString(timeout));
|
//setTimeout(Integer.toString(timeout));
|
||||||
|
setTimeout(timeout);
|
||||||
if (timeout != 0) {
|
if (timeout != 0) {
|
||||||
countdown.start();
|
countdown.start();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setTimeout(String text) {
|
// private void setTimeout(String text) {
|
||||||
|
// this.txtTimeRemaining.setText(text);
|
||||||
|
// }
|
||||||
|
|
||||||
|
private void setTimeout(int s){
|
||||||
|
int minute = s/60;
|
||||||
|
int second = s - (minute*60);
|
||||||
|
String text;
|
||||||
|
if(minute < 10){
|
||||||
|
text = "0" + Integer.toString(minute) + ":";
|
||||||
|
}else{
|
||||||
|
text = Integer.toString(minute) + ":";
|
||||||
|
}
|
||||||
|
if(second < 10){
|
||||||
|
text = text + "0" + Integer.toString(second);
|
||||||
|
}else{
|
||||||
|
text = text + Integer.toString(second);
|
||||||
|
}
|
||||||
this.txtTimeRemaining.setText(text);
|
this.txtTimeRemaining.setText(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue