$B%$%a!<%8$N07$$$H(B, Timer $B%/%i%9$K$h$k%"%K%a!<%7%g%s(B
$BL\
$B7HBS(BJava$B$N%Z!<%8(B
$B:G8e$N99?7$O
$B%$%a!<%8$r(B Panel $B$KE=$m$&(B
$B
/*
Panel $B$X$N(B Image $B$NE=$jJ}(B
2002/10/26
*/
import com.nttdocomo.ui.*;
/**
Panel $B$G$N(B Key $BF~NO$r$&$1$H$kNc$N%/%i%9(B
*/
public class ImageSample1 extends IApplication {
/** $B5/F0$9$k$H$-$K8F$P$l$k(B $B%a%=%C%I(B. $BI,?\(B. */
public void start(){
Panel p=new Panel();
MediaImage mi0=MediaManager.getImage("resource:///pose0.gif");
MediaImage mi1=MediaManager.getImage("resource:///pose1.gif");
try{
mi0.use();
Image img0=mi0.getImage();
ImageLabel il0=new ImageLabel(img0);
p.add(il0);
mi1.use();
Image img1=mi1.getImage();
ImageLabel il1=new ImageLabel(img1);
p.add(il1);
} catch (Exception e){
Label lb=new Label("gif $B$rE=$k$3$H$K<:GT(B");
p.add(lb);
}
Display.setCurrent(p);
}
}
/*
Local Variables:
mode: java
End:
*/
gif $B2hA|$NNc$O$3$3(B. $B%V%i%&%6$N1&%/%j%C%/$+$i%$%a!<%8$rJ]B8(B.
pose0.gif |  |
pose1.gif |  |
surface.gif |  |
spiral.gif |  |
$B$3$l$r(Bc:\iDK\apps\$BL>A0(B\res $B$KF~$l$k(B.
gif $B2hA|$r:n$m$&(B
$B<+J,$G(B gif $B2hA|$r$D$/$k$K$O(B,
$B$?$H$($P(B, Linux $B$N%S%C%H%^%C%W%(%G%#%?$r(B
penguin10% bitmap -size 20x30 &
penguin10% xpaint -size 20x30 &
penguin10% gimp &
$B$N$h$&$K;H$C$F(B, gif $B$GJ]B8$9$k(B. $BI,MW$J$i(B
xv $B$GJQ49$7$F(B gif $B$K$9$k(B.
$B%$%a!<%8$r(B Canvas $B$KE=$m$&(B
$B
/*
Canvas $B$X$N(B Image $B$NE=$jJ}(B $B$H(B Timer $B$r;H$C$?%"%K%a!<%7%g%s(B
2002/10/31
*/
import com.nttdocomo.ui.*;
import com.nttdocomo.util.*; // Timer $B$r;H$&$N$KI,MW(B.
/**
Panel $B$G$N(B Key $BF~NO$r$&$1$H$kNc$N%/%i%9(B
*/
public class ImageSample2 extends IApplication {
/** $B5/F0$9$k$H$-$K8F$P$l$k(B $B%a%=%C%I(B. $BI,?\(B. */
public void start(){
CanvasWithImage c=new CanvasWithImage();
Display.setCurrent(c);
}
}
class CanvasWithImage extends Canvas {
Image im[];
int t=0;
/** $B%3%s%9%H%i%/%?(B. $B:G=i$K(B1$B2s$@$1
$B%$%a!<%8$G%"%K%a!<%7%g%s$7$h$&(B
$B
/*
Canvas $B$X$N(B Image $B$NE=$jJ}(B $B$H(B Timer $B$r;H$C$?%"%K%a!<%7%g%s(B
2002/10/31
*/
import com.nttdocomo.ui.*;
import com.nttdocomo.util.*; // Timer $B$r;H$&$N$KI,MW(B.
/**
Panel $B$G$N(B Key $BF~NO$r$&$1$H$kNc$N%/%i%9(B
*/
public class ImageSample3 extends IApplication {
/** $B5/F0$9$k$H$-$K8F$P$l$k(B $B%a%=%C%I(B. $BI,?\(B. */
public void start(){
CanvasWithImage c=new CanvasWithImage();
Display.setCurrent(c);
Timer ti=new Timer();
ti.setTime(1000); // 1000$B%_%jIC$GH/@8$9$k%?%$%^!<(B
ti.setRepeat(true); // $B7+$jJV$7H/@8$9$k%?%$%^!<(B
ti.setListener(c); // $B$3$N%/%i%9(B c $B$N(B timerExpired $B$r;HMQ(B.
ti.start(); // $B%+%&%s%H%@%&%s3+;O(B. $B0l;~Dd;_$O(B, ti.stop();
}
}
class CanvasWithImage extends Canvas implements TimerListener {
Image im[];
int t=0;
/** $B%3%s%9%H%i%/%?(B. $B:G=i$K(B1$B2s$@$1C$9(B
g.drawImage(im[t],getWidth()/3,getHeight()/4); // $B3($rE=$k(B
}
/** Timer $B$,(B 0 $B$K$J$C$?$H$-8F$P$l$k%a%=%C%I(B
implements TimerListner $B$r@k8@$7$?$i$3$l$,I,MW(B */
public void timerExpired(Timer source){
t= (t+1) % 2; // $B;~4V$r?J$a(B
repaint(); // paint() $B$r:FEY8F$S=P$9(B.
}
}
/*
Local Variables:
mode: java
End:
*/
$B%"%K%a!<%7%g%s(B gif $B$N:F@8(B
$B
penguin15% gifsicle --delay=10 --loop pose0.gif pose1.gif pose2.gif > anim.gif
$B$J$I$H$9$l$P$h$$(B.
/*
Panel $B$X$N(B Image $B$NE=$jJ}(B
2002/10/26
*/
import com.nttdocomo.ui.*;
/**
Panel $B$G$N(B Key $BF~NO$r$&$1$H$kNc$N%/%i%9(B
*/
public class AnimSample1 extends IApplication {
/** $B5/F0$9$k$H$-$K8F$P$l$k(B $B%a%=%C%I(B. $BI,?\(B. */
public void start(){
Panel p=new Panel();
MediaImage mi=MediaManager.getImage("resource:///spiral.gif");
try{
mi.use();
VisualPresenter vp=new VisualPresenter();
vp.setImage(mi);
p.add(vp);
Display.setCurrent(p);
vp.play();
} catch (Exception e){
Label lb=new Label("gif $B$rE=$k$3$H$K<:GT(B");
p.add(lb);
Display.setCurrent(p);
}
}
}
/*
Local Variables:
mode: java
End:
*/
Copyright © 2002-2003 Saburo Higuchi. All rights reserved.
$BHu8};0O:(B,
http://www.math.ryukoku.ac.jp/~hig/