Sanjay Jayaram Rao wrote:I am not able to get the state of the button . what is a state of the button??? I used the isSelected() method on button i.e
The isSelected method doesn't make much sense for normal JButtons. It's main use is in JToggleButton, JCheckButton and JRadioButton.
I am kinda starting to wonder...that i can get around by using 2 buttons i.e one for start and one for stop .
That could be an option. You simply hide (setVisible(false)) the one you don't want shown. However, seeing as the layout manager may give you problems, you can achieve the same with two Action instances instead:
The switching code is quite easy then: