Prevent imageicon inside a JLabel from stretching to fit the JLabel
Posted on 2006-06-19
I have a JLabel and I have set an imageicon in it through the JLabel constructor.
Then I set the size of the JLabel with setBounds().
The setbounds() method sets the size of the JLabel that is larger than the size
of the image that i have set in the label as content.
My problem is that the imageIcon that I set in the JLabel, stretches to fit
Is there any way of keeping the ImageIcon from stretching to fit the label?
I want the iamge icon to remian its original propotion and size and the label
to show its normal background for the rest of the area that the imageicon doesnt cover.