File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "JLabel , image" Watch "JLabel , image" New topic
Author

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="http://www.mars3000.com" target="_blank" rel="nofollow">http://www.mars3000.com</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 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
 
Consider Paul's rocket mass heater.
 
subject: JLabel , image
 
Similar Threads
where r menuitems of popupmenu are defined when InternalFrames are minimized.
trouble with layouts
problem with actionevent
Moving a picture down a bit
SwingSet2 popup menu items are wrong when Look & Feel is changed