Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Thread t = new Thread() {
- @Override
- public void run() {
- BufferedReader reader = null;
- try {
- reader = new BufferedReader(new FileReader(LOGFILE));
- String line;
- while (running) {
- line = reader.readLine();
- if (line == null) {
- // wait until there is more lines in the file
- Thread.sleep(POLL_MS);
- } else {
- // append to the log Label
- synchronized (MyApplication.this) {
- log.setValue(log.getValue() + line + "<br />");
- }
- }
- }
- } catch (IOException e) {
- // TODO: handle me
- e.printStackTrace();
- } catch (InterruptedException e) {
- // TODO: handle me
- e.printStackTrace();
- } finally {
- running = false;
- if (reader != null) {
- try {
- reader.close();
- } catch (IOException ignore) {
- }
- }
- }
- }
- };
- t.start();
- ProgressIndicator pi = new ProgressIndicator();
- pi.setPollingInterval(POLL_MS);
- pi.setIndeterminate(true);
- layout.addComponent(pi);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement