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

JLabel , image

 
Edward Chen
Ranch Hand
Posts: 798
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a picture, then I slice into four small pictures, save them into four image file. then I put each image into a JLabel, the four JLabel with image put into JPanel and show up.

But, the result is, the GUI is not exactly as the picture. I don't know why ? My goal is , to get action listener on each image area.

 
Pat Hays
Ranch Hand
Posts: 138
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It seems your code is generated by JFrameBuilder.
Try this way, using multiple Panel and BoxLayout instead.
 
Edward Chen
Ranch Hand
Posts: 798
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your solution works. But I don't know why we need so many panels. Or we just use NULLLayout.

I am trying the JFramBuilder from Mars3000.com. I like its light weight, esay-use. I hope it has more swing component supports and nicer event handling. All in all, it is a good product.

Thanks
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic