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
use the following code :
if(name.getText().equals("")) { loginbt.disable(); }