简体   繁体   中英

Dynamic Buttons in Netbeans Design View

I am developing a GUI using Swing and Netbeans Design features. I'm a beginner to Netbeans and wondering if there is any way to 'hide' a button by calling a method or by changing any settings in GUI builder.
In the design view, I did not notice any option(s) to modify buttons with a method, and the code generated in source view is protected which I cannot edit.

So, is there any way to modify or program how a Jbutton works?

To bypass the locking of Netbeans code you can see how in this post Bypassing Lock on Generated Code in NetBeans 6.5? .

Now if just what you want is to hide a button that is very easy using

this.jButton1.setVisible(false);

You need to find a way to unlock the source code.. It should not even be locked. Then find the button variable in the source code and hide it by writing:

ButtonNameHere.setVisible(false); 

or if you just want to disable the button for a user, write

ButtonNameHere.setEnabled(false);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM