File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Swing / AWT / SWT and the fly likes JLabel , image Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "JLabel , image" Watch "JLabel , image" New topic

JLabel , image

Edward Chen
Ranch Hand

Joined: Dec 23, 2003
Posts: 798
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

Joined: Aug 20, 2004
Posts: 138
It seems your code is generated by JFrameBuilder.
Try this way, using multiple Panel and BoxLayout instead.

Download Java GUI Builder, <a href="" target="_blank" rel="nofollow"></a>
Edward Chen
Ranch Hand

Joined: Dec 23, 2003
Posts: 798
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 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.

Don't get me started about those stupid light bulbs.
subject: JLabel , image
It's not a secret anymore!