So I got know this is a popular question and already found the solution. But when I try this it doesn\'t work properly.
My JTextField is empty and the button isn\'t
Try this
if(name.getText() != null && name.getText().equals("")) { loginbt.setEnabled(false); } else { loginbt.setEnabled(true); }