1

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?

mustangDC
  • 945
  • 1
  • 12
  • 33
orpheus
  • 479
  • 1
  • 7
  • 20

2 Answers2

2

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);
Community
  • 1
  • 1
MaVRoSCy
  • 17,747
  • 15
  • 82
  • 125
0

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);
ghoulfolk
  • 326
  • 7
  • 17
  • Not really. You can simple switch to code mode and access the button like any normal object. Sure it won't hide it in design mode, but hay... – MadProgrammer Jun 25 '13 at 08:42