Privacy Policy Terms Of Use. Copyright © 2006-2010 Java Tutorials and Examples.
Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners.
- /* Using Fonts */
- /* Syntax
- Font(String F_Name, int F_Style, int F_ps) ps -> Size in Points
- To Set new Font Use Function
- Void setFont(Font f)
- */
- /* Color Cosntants { black, blue, cyan, darkGray, gray, green, ligntGray,
- magenta, orange, pink, red, white, yellow}
- */
- import java.applet.Applet;
- import java.awt.Graphics;
- import java.awt.Font;
- import java.awt.Color;
- /*
- <applet code = "Applet05" width = 300 height = 300>
- </applet>
- */
- public class Applet05 extends Applet
- {
- public void paint(Graphics g)
- {
- g.setColor(Color.blue);
- Font f = new Font("Impact",Font.PLAIN, 30);
- g.setFont(f);
- g.drawString("Hello World...",50,50);
- g.setFont(new Font("Serif",Font.BOLD, 20));
- g.drawString("Hello World...",75,100);
- }
- }

Post new comment