Issue
In Netbeans under the design tab, I am able to add in a JButton which generates a private member javax.swing.JButton jbutton1
.
I want all of my JButtons to implement a custom interface that I made called X as such:
public class myCustomButton extends javax.swing.JButton
implements X
{
//Some code here...
}
Is there a way to add in myCustomButtons instead of JButtons without messing up the Netbeans designer?
Solution
In the properties of the button on one of the tabs you can put in post creation code (look for that) or something similar which should do what you want. I'd be more specific if I had netbeans on my machine at the moment.
It shouldn't affect the layout in the designer.
This is what I'm talking about:
That image is from Netbeans 6 but it should not have changed. I believe it is either post-creation or post-declaration you are looking for.
Alternatively you can use the Code Customizer:
(source: netbeans.org)
Answered By - ldam