Given that a JToggleButton is a button with two-states, chances are that your JButtons, which are single state, do not have actions that correctly handle two states. As a result, this will most likely not be nearly as easy as it seems like it should be (as in Anthony's response) or your UI will not make sense with the new buttons.
What I would ask you is to think about the UI from two perspectives:
- Why are you switching all the JButtons to JToggleButtons? Does this provide any advantage to the user interface that will help your users overall? Is there something that can be done better?
- You mentioned that you have "hundreds" of JButtons. That makes me nervous when I hear that. Even for a fairly large application, that is a lot of buttons. This may mean your UI is cluttered and difficult to understand for a user.
Basically, think about why you are trying to do what you're trying to do. Is it really necessary? Is there something that could be an even better solution? I know this isn't the exact answer you were looking for, but I hope it helps.