pete stein wrote:
aml lopez wrote:Example:
VisiblePanel.add(new Jbutton("test"));
This works for me in Netbeans if VisiblePanel has a layout manager set. Otherwise it doesn't. And as I said there is no need to call revalidate or repaint.
I think that your solution has little to do with adding things at runtime as was specified in the original post. My guess (and guess is all I can do since you didn't post a program but rather a snippet) is that your button was added before the GUI was packed and displayed which is quite a different issue.
On a side note, I highly recommend that you not use NetBeans to generate your Swing code until you've learned how to do it by hand. Going through the Sun Swing tutorials and learning to code Swing will save you worlds of trouble later when you want to tweak your GUI into doing things that it didn't do before. I think that NetBeans code-generation is fine for quick and dirty apps, but using it too much actually stunts your Swing education.