title: Auto refresh for a jTextField from JDBC when loggin
body: <p>So, I'm making an APP for customer manager, but i'm not being able to retrive the DB sets and string them onto jTextField. Basically I made a Login screen, and once it's logged I wanna make a mini panel on botton showing the name of the seller.
  I've created a boolean on the DB, so I'm trying to make the code read the table and search the one wich is enabled. Made it in a way where only one of the datas are boolean true, so I know that is not the problem.</p>
  
  <p>Here is the Main Window Part:</p>
  
  <pre><code>private void vendorNameActionPerformed(java.awt.event.ActionEvent evt) {                                           
      DBConn.connect();
      try {
         Connection con = DriverManager.getConnection("jdbc:derby://localhost:1527/vitrini", "developer", "admin");
         String sql = "SELECT ? FROM DEVELOPER.VENDOR WHERE logged = ?";
         PreparedStatement ps = con.prepareStatement(sql);
         ps.setString(1, "name");
         ps.setBoolean(2, true);
         ResultSet rs = ps.executeQuery();
         while(rs.next()) {
             String user = rs.getString("name");
             vendorName.setText(user);
             vendorName.repaint();
             evt.getModifiers();
         }
      }
      catch(Exception e) {
          System.out.println(e);
  
      }
  }
  </code></pre>
  
  <p>And this is the Login Screen that turns the boolean on:</p>
  
  <pre><code>private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {                                         
      SessionManager.nullSession();
      try {
          Class.forName("org.apache.derby.jdbc.EmbeddedDriver");
      }
      catch(ClassNotFoundException e) {
          System.out.println(e);
      }
      try {
          Connection con = DriverManager.getConnection("jdbc:derby://localhost:1527/vitrini", "developer", "admin");
          Statement stmt = con.createStatement();
          ResultSet rs = stmt.executeQuery("SELECT * FROM DEVELOPER.VENDOR WHERE name='"+typedUser.getText()+"' AND PASSWORD='"+typedPass.getText()+"'");
          String user = typedUser.getText();
          String pass = typedPass.getText();
          if(user == "") {
              JOptionPane.showMessageDialog(null, "O campo de Usuário não pode ficar em branco.");
          } else if(pass == "") {
              JOptionPane.showMessageDialog(null, "O campo de Senha não pode ficar em branco.");
          } else if(rs.next()){
                  JOptionPane.showMessageDialog(null, "Login realizado com sucesso.");
                  String update = "UPDATE DEVELOPER.VENDOR SET logged = ? WHERE name = ?";
                  PreparedStatement ps = con.prepareStatement(update);
                  ps.setBoolean(1, true);
                  ps.setString(2, typedUser.getText());
                  ps.executeUpdate();
                  MainFrameGUI gui = new MainFrameGUI();
                  gui.setVisible(true);
  
                  this.dispose();
          }
          else {
                  JOptionPane.showMessageDialog(null, "Usuário ou senha incorretos.");
          }
      }
      catch(HeadlessException | SQLException e) {
          System.err.println(e);
      }
  </code></pre>
  
  <p>The jTextField is NOT EDITABLE, but keeps empty when it's done.
  Hope someone can help me out with this. Thanks a lot.</p>