Reputation: 34793
I have created hundreds of JButton using Netbeans in my Java Desktop App.
Now I want to replace all of them with JToggleButtons.
Can I do that by selecting all the buttons in the "Inspector" window of Netbeans and perform some task?
Is there any short-cut method?
It will take a lot of time to manually replace all of them.
Upvotes: 2
Views: 1638
Reputation: 54725
Netbeans will define an xml file (named YourComponent.form
which is not visible from inside NetBeans) containing the GUI definitions, including the JButton
s. I'd try doing a find-replace in this file and then reloading your project. Just make sure you take a back-up first!
Upvotes: 2
Reputation: 34652
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:
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.
Upvotes: 1
Reputation: 91816
Does Netbeans support find and replace all functionality? I would utilize that if its supported.
Upvotes: 1