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 28 29 |
/* Get Foreground Color Of an Applet Window Example This java example shows how to get foreground color of an Applet window using getForeground method of component class. */ /* <applet code="GetForegroundColorExample" width=200 height=200> </applet> */ import java.applet.Applet; import java.awt.Color; import java.awt.Graphics; public class GetForgroundColorExample extends Applet{ public void paint(Graphics g){ /* * Get Foreground color of an applet using * Color getForeground() method of Component class. */ Color c = getForeground(); g.drawString(c.toString(),50,50); } } |
Example Output
Add Comment