Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Assigning a JPanel to a new JPanel obejct!  RSS feed

 
Zee Tuff
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Something is bugging me! Here is the process:

1. Create panel and add a component to it
2. Add the panel to a frame
3. Create a new panel with a new component
4. Assign the new panel to the old panel
5. repaint

and nothing happens! Shouldn't the panel be updated?

Help is appreciated.

 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65830
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"green apple", please check your private messages for an important administrative matter.
 
Rob Spoor
Sheriff
Posts: 20893
81
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Where do you add your new JPanel to the JFrame? Remember, Java is pass-by-value, so the JFrame still has a reference to the old JPanel object after the assignment.
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!