Monday, January 10, 2011

Stretch Image in JLabel

JLabel myImageLabel = JLabel(new ImageIcon("Image Path"))
{
@Override
public void paintComponent(Graphics g) {
super.paintComponent(g);
g.drawImage(((ImageIcon)getIcon()).getImage(), 0, 0, getWidth(), getHeight(), null);
}
};

5 comments:

  1. YOU are my savior!
    Greets from Poland ;)

    ReplyDelete
  2. You saved me too ^^ Really thank you
    Greets from Spain :)

    ReplyDelete
  3. Man, you are the best!

    ReplyDelete
  4. Very nice . Thanks from me...

    ReplyDelete