• Post Reply Bookmark Topic Watch Topic
  • New Topic

randomly select colors from Applet  RSS feed

Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I relatively new to java, what I'm trying to do is list about five colours in my Applet and pass the colours into my java code, and maybe the font.....
I want to be able to Display a digital clock which randomly selects different colours which were passed from my Applet

Thanks for any help


Clock Code:

import java.awt.*;
import java.applet.*;
import java.util.*;
import java.text.*;

public class dclock extends Applet implements Runnable{
Thread animThread = null;
int delay = 1000;

public void init(){}

public void paint (Graphics g){
// get the time
Calendar cal = Calendar.getInstance();
Date date = cal.getTime();

// format it and display it
DateFormat dateFormatter =DateFormat.getTimeInstance();

g.drawString(dateFormatter.format(date), 5, 10);

public void start(){

if(animThread == null){
animThread = new Thread(this,"Animation");

public void stop(){animThread = null;}

public void run(){

while(animThread !=null){
try{ Thread.sleep(delay);}
catch(InterruptedException e){};
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!