#navi(../)
*Wipeアニメーションで画像を表示 [#z57d00bc]
>編集者:[[Terai Atsuhiro>terai]]~
作成日:2004-10-18~
更新日:&lastmod;

#contents

**概要 [#ta59a8ef]
WipeアニメーションでPNG画像を表示します。

#screenshot

**サンプルコード [#w7fb70a8]
 class WipeImage extends JComponent implements ActionListener {
   private int ww = 0;
   public WipeImage() {
     super();
     setBackground(Color.black);
   }
   public void paintComponent(Graphics g) {
     g.setColor(getBackground());
     g.fillRect(0, 0, getWidth(), getHeight());
     if(mode) {
       if(ww<((int) (icon.getIconWidth()))) ww=ww+10;
       else animator.stop();
     }else{
       if(ww>0) ww=ww-10;
       else animator.stop();
     }
     g.drawImage(icon.getImage(), 0, 0, 
                 (int) (icon.getIconWidth()),
                 (int) (icon.getIconHeight()), this);
     g.fillRect(ww, 0,
                (int) (icon.getIconWidth()),
                (int) (icon.getIconHeight()));
   }
  }

-&jnlp;
-&jar;
-&zip;

**解説 [#de5d804d]
javax.swing.Timerを使って表示する画像の幅をすこしずつ変更しています。

//**参考リンク
**コメント [#xe6a52cb]
#comment