Scusa se non ho risposto subito ma ho avuto parecchio da fare.
Se non ho capito male questo codice dovrebbe fare al caso tuo:
codice:
import java.awt.*;
import java.awt.event.ComponentEvent;
import java.awt.event.ComponentListener;
import javax.swing.*;
public class TestImmagineScalata {
private static JPanel p=new JPanel();
private static Image i=java.awt.Toolkit.getDefaultToolkit().getImage("C:/Documents and Settings/G.Costanz0/Desktop/Logo_.gif");
private static JLabel f=new JLabel();
private static Icon icon;
public static int new_w;
public static int new_h;
public static void main(String[] args) {
JFrame frame=new JFrame();
icon = new ImageIcon(i);
frame.getContentPane().add(p);
f.setIcon(icon);
p.add(f);
frame.setBounds(10,10,300,300);
p.addComponentListener(new ComponentListener(){
public void componentResized(ComponentEvent arg0) {
new_w=p.getWidth();
new_h=p.getHeight();
i=i.getScaledInstance(new_w,new_h,Image.SCALE_DEFAULT);
icon = new ImageIcon(i);
f.setIcon(icon);
}
public void componentMoved(ComponentEvent arg0) {}
public void componentShown(ComponentEvent arg0) {}
public void componentHidden(ComponentEvent arg0) {}
});
frame.setVisible(true);
}
}
Ciao.