Join
Blogs
Questions
Videos
Tags
Members
Search
 
 
Create your own blog, earn points and get popular!

Color

Rahimv's picture

Create simple applet, print text in different colors using start method

5
Your rating: None Average: 5 (1 vote)
  1. /* Applet Life Cycle */
  2. /*
  3.  init()
  4.  start()
  5.  stop()
  6.  destroy()
  7.  
  8. */
  9. import java.applet.Applet;
  10. import java.awt.Graphics;
  11. import java.awt.*;
  12. /*
  13.  <applet code = "Applet08" width = 500 height = 300>
  14.  </applet>
  15. */
  16. public class Applet08 extends Applet
  17. {
  18.  String s = "Hello World";
  19.  int i;
Rahimv's picture

Create simple applet and print text in various fonts

5
Your rating: None Average: 5 (1 vote)
  1. /* Using Fonts */
  2. /* Syntax
  3.  Font(String F_Name, int F_Style, int F_ps) ps -> Size in Points
  4.    To Set new Font Use Function
  5.  Void setFont(Font f)
  6. */
  7. /* Color Cosntants { black, blue, cyan, darkGray, gray, green, ligntGray,
  8.        magenta, orange, pink, red, white, yellow}
  9. */
  10. import java.applet.Applet;
  11. import java.awt.Graphics;
  12. import java.awt.Font;
  13. import java.awt.Color;
Rahimv's picture

Create simple applet and print string in different colors

0
Your rating: None
  1. /* Using Colors */
  2. /* Syntax
  3.  Color(int R, int G, int B)
  4.  Color(int rgb)
  5.  Color(float r, float g, float b)
  6. */
  7. /* Color Cosntants { black, blue, cyan, darkGray, gray, green, ligntGray,
  8.        magenta, orange, pink, red, white, yellow}
  9. */
  10.  
  11. import java.applet.Applet;
  12. import java.awt.Graphics;
  13. import java.awt.Color;
  14. /*
Rahimv's picture

Create simple applet, and print string in blue color

5
Your rating: None Average: 5 (1 vote)
  1. /* Using Colors */
  2. /* Syntax
  3.  Color(int R, int G, int B)
  4.  Color(int rgb)
  5.  Color(float r, float g, float b)
  6. */
  7. /* Color Cosntants { black, blue, cyan, darkGray, gray, green, ligntGray,
  8.        magenta, orange, pink, red, white, yellow}
  9. */
  10.  
  11. import java.applet.Applet;
  12. import java.awt.Graphics;
  13. import java.awt.Color;
  14. /*
Syndicate content