Color Handling in my Applet
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   dimitry_reilahce
Posted On:   Monday, May 14, 2001 07:23 AM

Looking for a job... Hi, I'm a newbie. Would like however to change the color of _both_ background and text displayed in the "Nervous Text" applet. No success at all. ************I'm running Mac OS 9.1*********** I tried to include some stuff from other examples without success. Please help... TIA echlrdm@hotmail.com ___ Java code _______________________________________ import java.awt.Graphics; import java.awt.Font; public class NervousText extends java.applet.Applet implements Runnable { char separated[]; String s = null; Thread killme = null; int i; int x_coord = 0, y_coord = 0; String num; int speed=35; int cou   More>>
Looking for a job...

Hi, I'm a newbie. Would like however to change the color of _both_ background and text displayed in the "Nervous Text" applet. No success at all.

************I'm running Mac OS 9.1***********

I tried to include some stuff from other examples without success. Please help... TIA echlrdm@hotmail.com

___ Java code _______________________________________
import java.awt.Graphics;
import java.awt.Font;

public class NervousText extends java.applet.Applet implements Runnable {

char separated[];
String s = null;
Thread killme = null;
int i;
int x_coord = 0, y_coord = 0;
String num;
int speed=35;
int counter =0;
boolean threadSuspended = false;

public void init() {
s = getParameter("text");
if (s == null) {
s = "I'm looking for a job."; ////////// my string here //////////////
}

separated = new char [s.length()];
s.getChars(0,s.length(),separated,0);
resize((s.length()+1)*15, 50);
setFont(new Font("Arial",Font.BOLD,36));
}

public void start() {
if(killme == null)
{
killme = new Thread(this);
killme.start();
}
}

public void stop() {
killme = null;
}

public void run() {
while (killme != null) {
try {Thread.sleep(100);} catch (InterruptedException e){}
repaint();
}
killme = null;
}

public void paint(Graphics g) {
for(i=0;i
{
x_coord = (int) (Math.random()*10+15*i);
y_coord = (int) (Math.random()*10+36);
g.drawChars(separated, i,1,x_coord,y_coord);
}
}

public boolean mouseDown(java.awt.Event evt, int x, int y) {
if (threadSuspended) {
killme.resume();
}
else {
killme.suspend();
}
threadSuspended = !threadSuspended;
return true;
}
}
___ HTML code___ calling the applet) _____________________










   <<Less

Re: Color Handling in my Applet

Posted By:   John_Zukowski  
Posted On:   Monday, May 14, 2001 08:05 AM

JavaScript - applet comms are already covered in the FAQ.
About | Sitemap | Contact