code: /*
   * StatusFrame.java
   *
   * Created on 28 Ιούλιος 2006, 11:39 πμ
   */
  
  package gr.demokritos.iit.jinsect.gui;
  
  import javax.swing.SwingUtilities;
  
  /**
   *
   * @author  ggianna
   */
  public class StatusFrame extends javax.swing.JFrame implements IStatusDisplayer {
      
      /** The text of the label, without any modification.
       */
      protected String LabelText;
      /** Creates new form StatusFrame */
      public StatusFrame() {
          super();
          
          initComponents();
      }
      
      /** This method is called from within the constructor to
       * initialize the form.
       * WARNING: Do NOT modify this code. The content of this method is
       * always regenerated by the Form Editor.
       */
      // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
      private void initComponents() {
          ProgressBar = new javax.swing.JProgressBar();
          StatusLbl = new javax.swing.JLabel();
  
          setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
          getContentPane().add(ProgressBar, java.awt.BorderLayout.CENTER);
  
          StatusLbl.setText("Status: Idle");
          StatusLbl.setPreferredSize(new java.awt.Dimension(250, 50));
          getContentPane().add(StatusLbl, java.awt.BorderLayout.SOUTH);
  
          pack();
      }// </editor-fold>//GEN-END:initComponents
      
      
      public synchronized void setStatus(final String sText, final double dValue) {
          LabelText = sText;
          try {
              SwingUtilities.invokeLater(new Runnable() {
                  public void run() 
                  {
                      String sTxt = sText;
                      if (dValue != -1)
                          sTxt = String.format("%3.2f%% - ", dValue * 100).concat(sTxt);
                      StatusLbl.setText(sTxt);
                      //StatusLbl.update(StatusLbl.getGraphics());
                      ProgressBar.setValue((int)(dValue * 100));
                      //ProgressBar.update(ProgressBar.getGraphics());
                      //update(getGraphics()); 
                  }
              });
          }
          catch (Exception e) {
              e.printStackTrace();
          }
      }
      
      public synchronized String getStatusText() {
          return LabelText;
      }
      /**
       * @param args the command line arguments
       */
      public static void main(String args[]) {
          java.awt.EventQueue.invokeLater(new Runnable() {
              public void run() {
                  new StatusFrame().setVisible(true);
              }
          });
      }
  
      public synchronized boolean getVisible() {
          return isVisible();
      }
  
      public synchronized double getStatusValue() {
          return (double)ProgressBar.getValue() / 100.0;
      }
      
      // Variables declaration - do not modify//GEN-BEGIN:variables
      private javax.swing.JProgressBar ProgressBar;
      private javax.swing.JLabel StatusLbl;
      // End of variables declaration//GEN-END:variables
      
  }
  