Medjutim, imam ghost efekat, sto se lako moze proveriti ovim parcetom koda:
Code:
public static void main(String[] args) throws MalformedURLException {
URL url = new URL("http://download.esignal.com/weather/wsi/radar/regional/san+.gif");
Icon icon = new ImageIcon(url);
JLabel label = new JLabel(icon);
JFrame f = new JFrame("Animation");
f.getContentPane().add(label);
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.pack();
f.setLocationRelativeTo(null);
f.setVisible(true);
}
public static void main(String[] args) throws MalformedURLException {
URL url = new URL("http://download.esignal.com/weather/wsi/radar/regional/san+.gif");
Icon icon = new ImageIcon(url);
JLabel label = new JLabel(icon);
JFrame f = new JFrame("Animation");
f.getContentPane().add(label);
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.pack();
f.setLocationRelativeTo(null);
f.setVisible(true);
}
Ako se uporedi to, sa pomenutim gifom, primetice se da se u Javi pojavljuje ghost efekat, odnosno da se prethodni frejmovi animacije zadrzavaju i onda se gif "razmazuje".
Pokusao sam sa ovim:
Code:
@Override
public boolean imageUpdate(Image img, int flags, int x, int y, int w, int h) {
repaint();
return true;
}
@Override
public boolean imageUpdate(Image img, int flags, int x, int y, int w, int h) {
repaint();
return true;
}
Ali ne daje nikakve rezultate.