I need the thing I type in the text field to store in a string so I can use that string in another class.
public void jButton1_actionPerformed(ActionEvent e) {
String sql = "Select * from clients where username=? and password=?";
try {
pst = conn.prepareStatement(sql);
pst.setString(1, jTextField.getText());
pst.setString(2, new String(jPasswordField.getPassword())); // /
I need this username I type in the jTextField to store as a string.
You get the text to put it in your PreparedStatement like this:
pst.setString(1, jTextField.getText());
You can use the same method to save it in a String:
String username = jTextField.getText();