Anims

pria

Mitglied
Hi,
Hab ma n paar Fragen , wie füge ich ohne viel Aufwand variable Grafiken in mein Fenster ein und wie kann ich animationen einfügen z.b. ein animiertes GIF?
 
Hallo,

schau mal hier:
Java:
/**
 * 
 */
package de.tutorials;

import java.net.URL;

import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JLabel;

/**
 * @author Tom
 */
public class AnimatedGifExample extends JFrame {

  public AnimatedGifExample() {
    super("AnimatedGifExample");
    setDefaultCloseOperation(EXIT_ON_CLOSE);
    try {
      ImageIcon imageIcon = new ImageIcon(new URL(
        "http://theorie.physik.uni-wuerzburg.de/~lemartin/animation/animation.gif"));
      add(new JLabel(imageIcon));
    } catch (Exception e) {
      e.printStackTrace();
    }
    pack();
    setVisible(true);
  }


  /**
   * @param args
   */
  public static void main(String[] args) {
    new AnimatedGifExample();
  }
}

Gruß Tom
 
Zurück