Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

layered Pane issues

 
Marco Salazar
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guys,

I'm trying to set one JPanel into JLayered Pane. I've tried everything I found in google but still no working. I want this new JPanel to be added to the JLayered Pane when the useres click a JMenu. Can someone give me some tips to get this done? Thanks in advance for your help
 
Campbell Ritchie
Sheriff
Pie
Posts: 49733
69
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to JavaRanch
We usually discuss that sort of question in our Swing forum. Moving.
 
Maneesh Godbole
Saloon Keeper
Posts: 11092
13
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How are you adding the JPanel? Have you set the depth? If not please go though this http://java.sun.com/docs/books/tutorial/uiswing/components/layeredpane.html
If yes, can you please show us your code where you are adding the JPanel?
 
Marco Salazar
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guys,

I'm creating my GUI using the drag &drop option from netbeans and it generates the code automatically. Btw, the Jpanel I'm trying to add is from other class.
Here is the code I have, thnx a lot for all your help. Also I try the link you gave me but it didn't work.

 
Rob Spoor
Sheriff
Pie
Posts: 20606
60
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Marco Salazar wrote:I'm creating my GUI using the drag &drop option from netbeans and it generates the code automatically.

Quit doing that immediately. You'll learn absolutely nothing that way, and the code created by your IDE is usually quite horrendous to read.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic