This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes image label Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "image label" Watch "image label" New topic
Author

image label

Jude Fawly
Ranch Hand

Joined: Dec 01, 2004
Posts: 33
hi,

i am using an image label. images with sizes 200x200 will fit in the label and the whole
display is neat. but when i load an image with width 300 pix for example, the whole display
gets messed up.
How can i be able to load any image size in the image label while keeping the display neat.
if this is not possible, how can i limit the JFileChooser to choose images with 200X200 pixels?

thanks for any help


Teach me to die that so I may<br />Rise glorious at the awful day
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19655
    
  18

You could choose to resize images if their sizes are not 200x200.

You can retrieve an Image object from an ImageIcon, scale it and set it again.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Ko Wey
Ranch Hand

Joined: Sep 08, 2003
Posts: 67
May be you could use a home-made image-panel, like this:
(this imagepanel will be the exact size of the image when placed in
an appropriate container)

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: image label
 
Similar Threads
ImageIcon trouble
Image display in layout manager
Problems dispaying icon
Download Images ones at a time in J2ME from server to Mobile
Image not loading