This week's book giveaway is in the JavaScript forum.
We're giving away four copies of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js and have Paul Jensen on-line!
See this thread for details.
Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript 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: 21047
85
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.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!