1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
/* Get Background Color Of an Applet Window Example This java example shows how to get background color of an Applet window using getBackground method of component class. */ /* <applet code="GetBackGroundColorExample" width=200 height=200> </applet> */ import java.applet.Applet; import java.awt.Color; import java.awt.Graphics; public class GetBackGroundColorExample extends Applet{ public void paint(Graphics g){ //get background color using getBackground method Color c = getBackground(); g.drawString(c.toString(),50,50); } } |
Example Output
hmm.. nice answer