dcsimg
BIG TROUBLE CLOSE DEADLINE PLEASE HELP
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   matthew_magliocca
Posted On:   Sunday, July 21, 2002 11:25 AM

This is driving me crazy. I don't have a lot of experience with applets but I had to make an animated game. It works in the appletviewer and if I open it by just clicking on the html page but it doesn't work in TOMCAT. It says it's running but none of the images come up. I've done some experiments and I know that the URL argument is correct and that drawImage returns true which I thought meant that there was nothing left to paint. I wrote a much similer applet and discovered that everything seems to be set-up right. I'm enclosing some of my code, can someone please look at it? It's pretty standard double buffering. public class TEST4 extends Applet implements Runnable, MouseLis   More>>

This is driving me crazy. I don't have a lot of experience with applets but I had to make an animated game.

It works in the appletviewer and if I open it by just clicking on the html page but it doesn't work in TOMCAT.

It says it's running but none of the images come up.

I've done some experiments and I know that the URL argument
is correct and that drawImage returns true which I thought meant that there was nothing left to paint.
I wrote a much similer applet and discovered that everything seems to be set-up right.
I'm enclosing some of my code, can someone please look at it?

It's pretty standard double buffering.

public class TEST4 extends Applet implements Runnable, MouseListener

{

int x;

int y;

int count;

Thread t;

Image buffer;

Graphics bufferg;

int z = 1; //which method to deal

Image BACK1;

Image SIDE1;

boolean dealt = false;

boolean U = false; //where are there cards

boolean L = false;

boolean D = false;

boolean R = false;

boolean UL = false;

boolean UR = false;

Vector hand;

Label s;

Label r;

Label l;


public void init()

{

s = new Label("NEW!");

r = new Label("NEW!");

l = new Label(" " + getCodeBase());


hand = new Vector(); //current hand

count = 0; //number of cards dealt

x = 0;

y = 0; //for coordinates


Dimension d = getSize();

buffer = createImage(d.width, d.height);


try{

URL url1 = new URL(getCodeBase() + "BACK.JPG");

URL url2 = new URL(getCodeBase() + "SIDE.JPG");

BACK1 = getImage(url1);

SIDE1 = getImage(url2);

}catch(Exception e)

{

r.setText(e.getMessage());

}


for(int q = 0; q < 13; q++)

hand.addElement(BACK1);


r.setText(" " + BACK1.getWidth(this));

addMouseListener(this);

add(s);

add(r);

add(l);

}


public void start()

{

t = new Thread(this);

t.start();

}


public void run()

{

showStatus("In run");

try{

do{

repaint();

Thread.sleep(100);

}while(count < 52);

dealt = true; //52 cards dealt?

repaint();

}catch(Exception e)
{}
}



public void update(Graphics g)

{

paint(g);

}


public void paint(Graphics g)

{


if(dealt == false)

{


if(z == 1)
{
LEFT(g);
L = true;
}

if(z == 2)
{
UL(g);
UL = true;
}


if(z == 3)
{
UP(g);
U = true;
}

if(z == 4)
{
UR(g);
UR = true;
}

if(z == 5)
{
RIGHT(g);
R = true;
r.setText(" " + BACK1.getWidth(this));
}

if(z == 6)
{
DOWN(g);
D = true;
}

if(z == 7)
z = 1;

}

else
SPREAD(g);
}


public void LEFT(Graphics g)

{

if(bufferg == null)

bufferg = buffer.getGraphics();




Dimension d = getSize();

bufferg.setColor(Color.white);

bufferg.fillRect(0, 0, d.width, d.height);

bufferg.drawImage(SIDE1, (360-x), 300, this);

HOLD(bufferg);

boolean b = g.drawImage(buffer, 0, 0, this);

showStatus(" " + b);

x+= 60;

if(x >= 360)

{

x = 0;

z++;

count++;

}

}

   <<Less

Re: BIG TROUBLE CLOSE DEADLINE PLEASE HELP

Posted By:   amandeep_midha  
Posted On:   Monday, July 29, 2002 04:10 AM

the image file names that u have used .. just check their case by listing on the command prompt... and it will work if u follow case sensitivity.
About | Sitemap | Contact