//Sample Java Applet
import java.awt.*;.........
import java.applet.*;.........
import javax.swing.*;.........
import java.util.*;.........
import java.io.*;.........
public class XfAmint extends Applet implements Runnable
{
int imgcnt = 4;
Image allimgs[] = new Image[imgcnt];
Image allimgs2[] = new Image[imgcnt];
Image allimgs3[] = new Image[imgcnt];
Image currImg, thisCard[] = new Image[imgcnt], winScratch;
Graphics gScratch;
Image blankimage;
Thread runner;
int imgmax = 4;
int xpos;
int ypos;
int xjump = 70;
int allwidth = 50;
int allheight = 50;
int i;
int x = 0;
public void init()
{
setBackground(Color.black);
ypos = (size().height / 18);
xpos = (size().width / 13);
String imgsrc[] = {"roses.jpg","mixedf.jpg","mixedf2.jpg","roses2.jpg"};
String imgsrc2[] = {"mixedf3.jpg","mixedf4.jpg","mixedf5.jpg","mixedf6.jpg"};
String imgsrc3[] = {"mixedf7.jpg","mixedf8.jpg","mixedf9.jpg","mixedf10.jpg"};
for (i=0; i < allimgs.length; i++)
{
allimgs[i] = getImage(getCodeBase(),"images/" + imgsrc[i]);
allimgs2[i] = getImage(getCodeBase(),"images/" + imgsrc2[i]);
allimgs3[i] = getImage(getCodeBase(),"images/" + imgsrc3[i]);
}
blankimage = getImage(getCodeBase(),"images/blankimg.jpg");
winScratch = createImage(this.size().width, this.size().height);
gScratch = winScratch.getGraphics();
}
public void start()
{
if (runner == null)
{
runner = new Thread(this);
runner.start();
}
}
public void stop()
{
if (runner != null)
{
runner.stop();
runner = null;
}
}
public void run()
{
for (int r=0; r < 1000; r++)
{
ypos = (this.size().height / 18);
xpos = (this.size().width / 13);
for (int i=0; i < allimgs.length; i++)
{currImg = allimgs[i];
repaint();
pause(1500);
if (x==4)
{allwidth -= xjump;
allheight -= xjump;}
else
{allwidth += xjump;
allheight += xjump;}
if ((i == allimgs.length) & (x==0))
{x=1;}
if ((i == allimgs.length-1) & (x==4))
{i = 0-1; x=0;}
}
animcenter();
animright();
}
public void animcenter()
{ xpos = (this.size().width / 7 );
x=0;
for (int i=0; i < allimgs2.length; i++)
{currImg = allimgs2[i];
repaint();
pause(1500);
if (x==0)
{allwidth -= xjump;
allheight -= xjump;}
else
{allwidth += xjump;
allheight += xjump;}
if ((i == allimgs2.length-1) & (x==0))
{i = 0-1; x=1;}
}
}
public void animright()
{ xpos = (this.size().width / 3);
xpos -= 70;
for (int i=0; i < allimgs3.length; i++)
{currImg = allimgs3[i];
repaint();
pause(1500);
if (x==1)
{allwidth -= xjump;
allheight -= xjump;}
else
{allwidth += xjump;
allheight += xjump;}
if ((i == allimgs3.length-1) & (x==1))
{i = 0-1; x=3;}
if ((i == allimgs3.length) & (x==3))
{x=4;}
}
}
public void pause(int time)
{
try { Thread.sleep(time); }
catch (InterruptedException e) {}
}
public void paint(Graphics g)
{
gScratch.setColor(this.getBackground());
gScratch.fillRect(0,0,this.size().width, this.size().height);
gScratch.setColor(Color.black);
gScratch.drawImage(currImg, xpos, ypos, allwidth, allheight, this);
gScratch.drawRoundRect(xpos, ypos, allwidth, allheight, 1, 1);
g.drawImage(winScratch, xpos, ypos, this);
}
// stop screen from flickering
public void update(Graphics g)
{
paint(g);
}
}