Hello!

I have size about 200*250 icon for my simple application. I need to put it inside on frame as (about) 40*40 size. But when i try everything (image icon, icon for JLabel...) but i could not re-size it inside on JFreme. I f i set the size as 40*40, it just shows the small part of image ( about %20 of image).

Can someone help me for that?

Thank you!

You will have to re-scale your image to to the size you want it to be. You can use the getScaledInstance method on your Image to create a smaller version that will fit your JFrame.

You will have to re-scale your image to to the size you want it to be. You can use the getScaledInstance method on your Image to create a smaller version that will fit your JFrame.

Works Thank you! :)

Easiest way is make an ImageIcon of it, and use that in a LJabel.

you have to use LayoutManager, because anything layed by using NullLayout is by default non-resiziable

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.