protected RfbPlayer player;
protected Button playButton;
protected Button pauseButton;
+ protected TextField posText;
+
+ protected int lastPos = -1;
ButtonPanel(RfbPlayer player) {
this.player = player;
pauseButton.setEnabled(false);
add(pauseButton);
pauseButton.addActionListener(this);
+
+ posText = new TextField(4);
+ posText.setEditable(false);
+ add(posText);
}
public void setMode(int mode) {
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.
//
}
}
+ public void updatePos() {
+ buttonPanel.setPos(fbsStream.getPos());
+ }
+
//
// readParameters() - read parameters from the html source or from the
// command line. On the command line, the arguments are just a sequence of
zlibInflater = new Inflater();
tightInflaters = new Inflater[4];
+ player.updatePos();
+
// Main dispatch loop.
while (true) {
throw new IOException("Unknown RFB message type " + msgType);
}
+ player.updatePos();
+
if (player.getMode() == player.MODE_STOPPED) {
throw new EOFException("Playback stopped");
}