1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
/* Set Background Color Of an Applet Window Example This java example shows how to set background color of an Applet window using setBackground method of component class. */ /* <applet code="SetBackgroundColorExample" width=200 height=200> </applet> */ import java.applet.Applet; import java.awt.Color; import java.awt.Graphics; public class SetBackgroundColorExample extends Applet{ public void paint(Graphics g){ /* * Set background color of an applet using * void setBackground(Color c) method. */ setBackground(Color.red); } } |
Example Output
setColor() is from which package and class ?
pls share how to set random color to background of an applet
not possible