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.
JButton#isEnabled changes the user interactivity of a component, that is, whether a user is able to interact with it (press it) or not.
When a JButton is pressed, it fires a actionPerformed event.
You are receiving Add button is pressed when you press the confirm button because the add button is enabled. As stated, it has nothing to do with the pressed start of the button.
Based on you code, if you tried to check the "pressed" start of the add button within the confirm button's ActionListener it would always be false, as the button will only be in the pressed state while the add button's ActionListeners are being called.
Based on all this information, I would suggest you might want to consider using a JCheckBox which you can then use JCheckBox#isSelected to determine if it has being checked or not.
Take a closer look at How to Use Buttons for more details