title: How can I change the visibility of a JTextArea/JTextLabel?
body: <p>I tried using <code>.setVisibility(true)</code> but got a <code>NullPointerException</code>. How can I do this more effectively? I want the labels and fields to start invisible then become visible when the user presses a button. I also want to change the size of an object. Ideas?
  Heres one of the line of error:</p>
  
  <pre><code>public JLabel lblName;
  
  
  
  
      JLabel lblName = new JLabel("Name:");
      lblName.setFont(new Font("Tahoma", Font.PLAIN, 15));
      lblName.setBounds(10, 91, 79, 19);
      panel.add(lblName);
      lblName.setVisible(false);
  
  
      public void actionPerformed(ActionEvent e) {
          lblName.setVisible(true);
      }
  </code></pre>
  
  <p>All of the above are seperate code snippets that worked flawlessly until I added the 3rd snippet.</p>