Create Software Components 

Using Java Level 2

 

 

Course Info

Scheme

Resources

Tutorials

Java Demos

Utilities

Links


 

A Clock (1.6)


alt="Your browser understands the <APPLET> tag but isn't running the applet, for some reason." Your browser is completely ignoring the <APPLET> tag!

The clock applet now has three parameters; the background color (bgcolor), the main foreground color (the hands and dial) (fgcolor1) and the secondary foreground color (the seconds hand and numbers) (fgcolor2). These three parameters are hexadecimal RGB numbers (like the ones used for the body bgcolor tag in HTML). For example:

<applet code="Clock.class" width=170 height=150>
<param name=bgcolor value="000000">
<param name=fgcolor1 value="ff0000">
<param name=fgcolor2 value="ff00ff">
</applet>

would give you a black background, a red dial and hands, and purple numbers.

For those who don't convert to hexadecimal easily, here are some common values:

  • black = 000000
  • blue = 0000ff
  • cyan = 00ffff
  • darkGray = 404040
  • gray = 808080
  • green = 00ff00
  • lightGray = c0c0c0
  • magenta = ff00ff
  • orange = ffc800
  • pink = ffafaf
  • red = ff0000
  • white = ffffff
  • yellow = ffff00

The source.

  Site Home 

Java Home   

  Forum  

Course Info

Welcome

Overview

Assessment

Qualification

Scheme of Work

Assignments

Resources

Information

Blackboard

Learning Center

Web Materials

Reading

Java Demos

Utilities

Links

Lecture Materials

Tutorials & Notes

Exercises

Activities

Quizzes

 

Site Home

Top

Unit Home

ADR 2002