Text field in the ButtonPanel to show current time offset in seconds.
git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@2507 3789f03b-4d11-0410-bbf8-ca57d06f2519
diff --git a/java/src/com/tightvnc/rfbplayer/ButtonPanel.java b/java/src/com/tightvnc/rfbplayer/ButtonPanel.java
index e7cabb5..62fa88b 100644
--- a/java/src/com/tightvnc/rfbplayer/ButtonPanel.java
+++ b/java/src/com/tightvnc/rfbplayer/ButtonPanel.java
@@ -26,6 +26,9 @@
protected RfbPlayer player;
protected Button playButton;
protected Button pauseButton;
+ protected TextField posText;
+
+ protected int lastPos = -1;
ButtonPanel(RfbPlayer player) {
this.player = player;
@@ -41,6 +44,10 @@
pauseButton.setEnabled(false);
add(pauseButton);
pauseButton.addActionListener(this);
+
+ posText = new TextField(4);
+ posText.setEditable(false);
+ add(posText);
}
public void setMode(int mode) {
@@ -68,6 +75,19 @@
player.setMode(mode);
}
+ public void setPos(int pos) {
+ if (pos != lastPos) {
+ lastPos = pos;
+ char[] zeroes = {'0', '0', '0', '0'};
+ String text = String.valueOf(pos);
+ if (text.length() < 4) {
+ text = new String(zeroes, 0, 4 - text.length()) + text;
+ }
+ posText.setText(text);
+ posText.setCaretPosition(text.length());
+ }
+ }
+
//
// Event processing.
//