title: label name can not be resolved
body: <p>I've created a label <code>loginLabel</code> to show message on wrong authentication. I've kept this logic inside <code>actionPerformed</code> method, but I am getting error as <code>loginLabel can not be resolved</code>. How to remove this error? I've created my GUI using window-builder.</p>
  
  <pre><code>import java.awt.EventQueue;
  
  import javax.swing.JFrame;
  import javax.swing.JPanel;
  import javax.swing.border.LineBorder;
  import java.awt.Color;
  import javax.swing.JLabel;
  import java.awt.Font;
  import javax.swing.JTextField;
  import javax.swing.JPasswordField;
  import javax.swing.JButton;
  import java.awt.event.ActionListener;
  import java.awt.event.ActionEvent;
  import java.sql.*;
  
  public class FirstView {
  
      private JFrame frmFirstProject;
      private JTextField txtUsername;
      private JPasswordField txtPassword;
  
      /**
       * Launch the application.
       */
      public static void main(String[] args) {
          EventQueue.invokeLater(new Runnable() {
              public void run() {
                  try {
                      FirstView window = new FirstView();
                      window.frmFirstProject.setVisible(true);
                  } catch (Exception e) {
                      e.printStackTrace();
                  }
              }
          });
      }
  
      /**
       * Create the application.
       */
      public FirstView() {
          initialize();
      }
  
      /**
       * Initialize the contents of the frame.
       */
      private void initialize() {
          frmFirstProject = new JFrame();
          frmFirstProject.getContentPane().setBackground(new Color(51, 204, 204));
          frmFirstProject.setTitle("first project");
          frmFirstProject.setBounds(100, 100, 714, 491);
          frmFirstProject.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
          frmFirstProject.getContentPane().setLayout(null);
  
          JPanel panel = new JPanel();
          panel.setBorder(new LineBorder(new Color(0, 0, 0), 3));
          panel.setBounds(63, 47, 580, 354);
          frmFirstProject.getContentPane().add(panel);
          panel.setLayout(null);
  
          JLabel lblUsername = new JLabel("Username:");
          lblUsername.setBounds(24, 25, 69, 22);
          panel.add(lblUsername);
  
          JLabel lblPassword = new JLabel("Password:");
          lblPassword.setBounds(24, 66, 69, 22);
          panel.add(lblPassword);
  
          txtUsername = new JTextField();
          txtUsername.setBounds(97, 26, 86, 20);
          panel.add(txtUsername);
          txtUsername.setColumns(10);
  
          txtPassword = new JPasswordField();
          txtPassword.setBounds(97, 67, 86, 20);
          panel.add(txtPassword);
  
          JButton btnsubmit = new JButton("submit");
          frmFirstProject.getRootPane().setDefaultButton(btnsubmit); //enter key
          btnsubmit.addActionListener(new ActionListener() {
              public void actionPerformed(ActionEvent arg0) {
                  try {
                      int val = 0;
                      Connection sqlCon = DB_con.getSQLConnection();
                      PreparedStatement ps = sqlCon.prepareStatement("select 1 from tbl_user_info where username = ? and password = ?");
                      ps.setString(1, txtUsername.getText().toUpperCase());
                      ps.setString(2, String.valueOf(txtPassword.getPassword()).toUpperCase());
                      ResultSet rs = ps.executeQuery();
                      if (rs.next()) {
                          val = rs.getInt(1);
                      }
                      if(val != 1)
                      {
                          loginLabel.setVisible(true);
                      }
                      System.out.println("the value is: "+val);
                      sqlCon.close();
                      System.exit(0);
                  } catch (Exception e) {
                      System.out.println(e.toString());
                  }
  
              }
          });
          btnsubmit.setBounds(94, 125, 89, 23);
          panel.add(btnsubmit);
  
          JPanel panel_display = new JPanel();
          panel_display.setBounds(36, 181, 355, 50);
          panel.add(panel_display);
          panel_display.setLayout(null);
  
          JLabel loginLabel = new JLabel("Login Authentication Mismatched. Please try again.");
          loginLabel.setFont(new Font("Tahoma", Font.PLAIN, 13));
          loginLabel.setBounds(10, 11, 319, 28);
          panel_display.add(loginLabel);
          loginLabel.setVisible(false);
  
          JLabel lbl_header = new JLabel("LIBRARY MANAGEMENT SYSTEM");
          lbl_header.setFont(new Font("Tahoma", Font.BOLD, 14));
          lbl_header.setBounds(211, 11, 288, 25);
          frmFirstProject.getContentPane().add(lbl_header);
      }
  }
  </code></pre>