• Post Reply Bookmark Topic Watch Topic
  • New Topic

invisible components  RSS feed

Aaron Wilt
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello all-
I posted this in the applet forum, but didn't get much of a response..
I'm writing a JApplet that has 2 jlabels, 2 jcomboboxs, and 1 jbutton (along with some other lines and rectangles etc). I'm creating these components in my init() method, and adding them to the content pane. I'm not using any layout manager, instead I'm using insets to place them at particular coordinates on the content pane.
When the Japplet loads i can see one of the comboboxs on the screen, yet none of my other components show up. If i click my mouse where i know the button or jcombobox is supposed to be, it magically appears, that is, until my paint method gets called again and it goes away. I'm puzzled.
I've read some places about using validate(), but my understanding is it tells the layoutmanager to re-lay everything out and show it again, but as mentioned before, I'm not using a layout manager (i set it to null).
Here is a snipit of my code.. Assume variables are declared globally.

I cannot seem to figure my problem.. advice would be much appreciated! I thought once a component was added during init() it would stay there, but anytime my applet repaints, they disappear... Please help!
[ May 02, 2002: Message edited by: Aaron Wilt ]
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!