How can I check that JButton is pressed? I know that there is a method that its name is \"isEnabled\"
So I try to write a code to test.
The method you are trying to use checks if the button is active:
btnAdd.isEnabled()
When enabled, any component associated with this object is active and able to fire this object's actionPerformed method.
This method does not check if the button is pressed.
If i understand your question correctly, you want to disable your "Add" button after the user clicks "Check out".
Try disabling your button at start: btnAdd.setEnabled(false) or after the user presses "Check out"