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

displaying alternate jpanels in a jframe  RSS feed

 
samual smith
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi, i want to display the attack jpanel in the same frame when the button is clicked but instead it opens in a new frame

 
Rob Spoor
Sheriff
Posts: 20893
81
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch!

Please UseCodeTags next time, but don't forget to maintain the indentation. I've added both this time.

You are creating a new JFrame which you are then showing. You should instead change the current frame. The usual way is to use a CardLayout.
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!