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?

2
  • :Code generated is locked?? You must be doing something wrong . The source code is very well editable while designing. Commented Jun 25, 2013 at 8:12
  • Jbutton.setVisible(false) will 'hide' it Commented Jun 25, 2013 at 8:22

2 Answers 2

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);
Sign up to request clarification or add additional context in comments.

Comments

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);

1 Comment

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...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.