Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Question about JPanel

 
Alex Graham
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am just wondering why this code will not show the label and button in the panel. I tried to shorted the code as much as possible. Thanks for any help.

 
K. Tsang
Bartender
Posts: 3610
16
Firefox Browser Java Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You forgot to add the panel to the JFrame! Hence when visible it's blank.
 
Alex Graham
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just to help out anyone that might need this. After some researching I found out all I had to do was add this:
and then it worked. I added it right before Thanks for the help.
 
Campbell Ritchie
Marshal
Posts: 52631
119
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moving to our GUIs forum.

Remember to call setVisible last. Things altered after they become visible may not be displayed correctly.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!