title: java setText is not working in JLabel
body: <p>Trying to display sql results in a JLabel. I'm using netbeans so it does auto code generation for the swing components.</p>
  
  <p>Welcome_screen.java, main method</p>
  
  <pre><code>package my.welcomescreen;
  import java.io.InputStream;
  import java.sql.*;
  import javax.swing.*;
  
  public class Welcome_screen extends javax.swing.JFrame {
  
    public Welcome_screen() {
      initComponents();
  
    }
  
    private void initComponents() {
  
      jLabel9 = new javax.swing.JLabel();
  
    }
  
    public static void main(String args[]) {
      Welcome_screen courses = new Welcome_screen();
      courses.getCourses();
  
  
      java.awt.EventQueue.invokeLater(new Runnable() {
          public void run() {
              new Welcome_screen().setVisible(true);
  
           }
        });
     }
  
    public void getCourses(){
  
      db obj = new db();
      obj.dbconnect();
      String Query = "select * from courses";
      try{
          Connection con = obj.dbconnect();
          Statement st = con.createStatement();
          ResultSet rs = st.executeQuery(Query);
  
          if(rs.next()){
              //System.out.println(rs.getString("name"));
              jLabel9.setText(rs.getString("name"));
          }
  
  
  
      }catch(Exception e){
          System.out.println(e);
      }
  
  
  }
  
  private javax.swing.JLabel jLabel9;
  
  }
  </code></pre>
  
  <p>db.java, database connect file. </p>
  
  <pre><code>package my.welcomescreen;
  import java.sql.*;
  
  public class db {
  
      public static Connection dbconnect(){
          Connection con=null;
           try {
  
            Class.forName("com.mysql.jdbc.Driver");
            con = DriverManager.getConnection("jdbc:mysql://localhost/st2", "root", "");
  
  
      }
        catch (ClassNotFoundException | SQLException e){
        System.out.println(e);
    }
       return con; 
   }
  
  }
  </code></pre>
  
  <p>when i print sql results to the command line it works. expected result is displaying. But in the JLabel nothing happens. Not even an error is occurring. I can't find what's wrong. A little help would be appreciated !</p>