#navi(contents-page-name): No such page: ST

Terai Atsuhiro 2021-11-18 (木) 11:29:22

http://terai.s55.xrea.com/swing/wipe/screenshot.png

class WipeImage extends JComponent implements ActionListener {
  private int ww = 0;
  public WipeImage() {
    super();
    setBackground(Color.black);
  }
  public void paint(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()));
  }
 }