Win a copy of Svelte and Sapper in Action this week in the JavaScript forum!

Hector Rui

Greenhorn
+ Follow
since Sep 09, 2005
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Hector Rui

thankyou
I use this example but it is for loading an applet that use images my applet use graphics. how do I substitute the image on this applet with my graphics.

import java.applet.*;
import java.awt.*;
import java.net.*;

public class loadingApplet extends Applet implements Runnable
{
private Image bigGIF;
private Thread thread;
private MediaTracker mt;
private boolean loaded;
private String message;


public void init()
{
super.init();

String gif = this.getCodeBase().toString() + "waytoobig.gif";
message = "Loading (be more original than this!) ...";

try
{
bigGIF = this.getImage(new URL(gif));
}
catch (MalformedURLException e) { }

mt = new MediaTracker(this);
mt.addImage(bigGIF, 1);

loaded = false;

thread = new Thread(this);
thread.start();
}


public void paint(Graphics g)
{
if (loaded)
{
g.drawImage(bigGIF, 0, 0, this);
}
else // (!loaded)
{
g.setColor(Color.blue);
g.fillRect(0, 0, this.size().width, this.size().height);

g.setColor(Color.white);
g.drawString(message, 10, 20);
}
}


public void run()
{
try
{
paint(this.getGraphics());

while(mt.statusAll(true) != MediaTracker.COMPLETE)
{
message += "..";
paint(this.getGraphics());
thread.sleep(500);
}
}
catch (InterruptedException e)
{
}
finally
{
loaded = true;
paint(this.getGraphics());
}
}


}
15 years ago
Hello everyone
If someone can helpme please. I'll like to know how to change the gray color and write a loading message when loading an applet. I'm using graphics not images.

thankyou
15 years ago