title: Adding a status bar to Java application
body: <p>I want to add a status bar into my Java application in netbeans.</p>
  
  <p>I googled about it and I found this article:</p>
  
  <p><a href="https://stackoverflow.com/questions/3035880/how-can-i-create-a-bar-in-the-bottom-of-a-java-app-like-a-status-bar">How can I create a bar in the bottom of a Java app, like a status bar?</a></p>
  
  <p>I did the same as in that article but I had an error.</p>
  
  <p>This is the code I tried:</p>
  
  <pre><code>public void run() {
  
      PersonelMainForm personelMainForm = new PersonelMainForm();
  
      personelMainForm.setExtendedState(
          personelMainForm.getExtendedState()|JFrame.MAXIMIZED_BOTH );
  
      // create the status bar panel and shove it down the bottom of the frame
      statusPanel = new JPanel();
      statusPanel.setBorder(new BevelBorder(BevelBorder.LOWERED));
      PersonelMainForm.add(statusPanel, BorderLayout.SOUTH);
      statusPanel.setPreferredSize(new Dimension(PersonelMainForm.getWidth(), 16));
      statusPanel.setLayout(new BoxLayout(statusPanel, BoxLayout.X_AXIS));
      JLabel statusLabel = new JLabel("status");
      statusLabel.setHorizontalAlignment(SwingConstants.LEFT);
      statusPanel.add(statusLabel);
  
      personelMainForm.setVisible(true);
  }
  </code></pre>
  
  <p>and this is the error message for the line <code>PersonelMainForm.add(statusPanel, BorderLayout.SOUTH);</code> :</p>
  
  <blockquote>
    <p>non-static method <code>add(java.awt.Component,java.lang.Object)</code> cannot be
    referenced from a static context</p>
  </blockquote>
  
  <p>and this is the error message for the line <code>statusPanel.setPreferredSize(new Dimension(PersonelMainForm.getWidth(), 16));</code> :</p>
  
  <blockquote>
    <p>Exception in thread "AWT-EventQueue-0" <code>java.lang.RuntimeException</code>:
    Uncompilable source code - non-static method <code>getWidth()</code> cannot be
    referenced from a static context</p>
  </blockquote>