Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JLayeredPane does not show up in JPanel with GridBagLayout

 
Ruchi Kumctr
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to place a loading circle (Image in a JLabel (lblImage)) on top of an image (Image in a JLabel (lblDndImage)) in a JPanel with GridBagLayout (panelTop). lblImage and lblDndImage are both set elsewhere. When I change the panelTop (JPanel) to a BoxLayout, both images show up, but in the GridBagLayout, they do not show up. What am I doing wrong or missing? I have even tried placing the JlayeredPane in a Jpanel with BoxLayout, and placing that in my final JPanel (panelTop), but it does not work.

Basic code is:

 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
just tried the code, added necessary labels, and frame extras, and all worked fine.

problem might be in something not posted.
 
Ruchi Kumctr
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not sure if it makes a difference, but JPanel (panelTop) is in a JSplitPane.
 
Ruchi Kumctr
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nevermind. My JLayeredPane height was bigger than the actual JPanel height so it did not show up.

Thanks for the help.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic