Professional Documents
Culture Documents
Applet PGM To Change Background and Foreground
Applet PGM To Change Background and Foreground
We have two predefined methods in Java called setBackground() and setForeground() which are used for setting Background and
Foreground of an Applet Window respectively.
The Color class defines the constant values: Color.white, Color.grey, Color.blue, Color.red, Color.white
/* ProgrammingUnit.com */
import java.awt.*;
import java.applet.*;
/*
</applet>
*/
1
setForeground(Color.white);
setBackground(Color.blue);
Output