★ wanayoo — archive 1999 http://javaboutique.webdeveloper.com/tutorials/Java_by_Example/section3_1.htmlNouvelle recherche | Portail wanayoo
80211 Planet

The Event For Leading Edge Flash Development


Find a Web Host With:
CGI Access
DB Support
NT Servers
UNIX Servers
Telnet Access

advanced search
Internet News
Internet Investing
IT
Windows Technology
Linux/Open Source
Developer
Interactive Marketing
xSP Resources
Small Business
Wireless Internet
Downloads
Internet Resources
Internet Lists
International
EarthWeb
Career Resources

Search internet.com
Advertise
Corporate Info
Newsletters
E-mail Offers
Be a Commerce Partner
Business Search
Internet Jobs
Shop For Computers
IT Training
Breathing Problems?
Website Monitoring
Software Store
Promote Your Website
Track Defects Online
Web Hosting
FlashKit
Gif.com
HierMenusCentral
JavaBoutique
JavaScript.com
JavaScriptSource
WebDev Jobs
JustSMIL
ScriptSearch
StreamingMediaWorld
Web Hosts
WebDevelopersJournal WDVL
WebDeveloper.com
WebReference.com
XMLFiles.com
CGI
HTML
Java
JavaScript
Web Design and Promotion
Web Site Development
E-mail Address:


Can you receive
HTML e-mail?

Yes   No

Zip Code:



Tutorials : Java by Example : Section 3 :
Section Three Contents
Fonts, Random Numbers and Timers
Flicker Free Graphics, GIF and JPEG Display
Animation with GIF Pictures, Sprite Animation

Fonts and Graphics

Fonts, Random Numbers and Timers

This applet demonstrates the use of True Type Fonts in Java. Basically you have only the choice between TimesRoman, Courier and Helvetica if you want your applet to run on all machines. Fonts are objects which have to be created with new. You can add the BOLD and ITALIC attributes seperately or in combination. The size can be set in the last parameter of the Font constructor.

//Sourcecode

import java.awt.*;
import java.applet.*;

//demonstrates the use of fonts
public class Project6 extends Applet
{
        Font font1 = new Font("Helvetica", Font.PLAIN,  22);
        Font font2 = new Font("TimesRoman", Font.PLAIN,  20);
        Font font3 = new Font("Courier", Font.PLAIN,  18);

        Font font4 = new Font("Helvetica", Font.BOLD,  16);
        Font font5 = new Font("Helvetica", Font.ITALIC,  16);
        Font font6 = new Font("Helvetica", Font.BOLD + Font.ITALIC,  16);

        public void paint(Graphics g)
        {
                g.setFont(font1);
                g.drawString("This is Font 1 (Helvetica)", 30,30);

                g.setFont(font2);
                g.drawString("This is Font 2 (TimesRoman)", 30,80);

                g.setFont(font3);
                g.drawString("This is Font 3 (Courier)", 30,130);

                g.setFont(font4);
                g.drawString("This is Helvetica Bold", 30,180);

                g.setFont(font5);
                g.drawString("This is Helvetica Italic", 30,230);

                g.setFont(font6);
                g.drawString("This is Helvetica Bold and Italic", 30,280);
        }
}

internet.com logo














WebDev News

JBoss Group: Defections Aren't a Big Deal

IE Object Tag Buffer Overflow Patched

SCO Shuts Down German Site





JWizardPane
Build modern wizard style interface quickly. API easy to use. Bulti-in show dialog and frame support.
Download of the Week
BSCOutline v5.10
BSCOutline Java Outline Applet is a customizable tree view control for use in Web pages, similar to that used by Windows File Manager or Explorer. BSCOutline has been written to be the simple to use and small to store.

JB User Poll
As a JavaBoutique Reader what kind of articles do you prefer?
The JavaBoutique Top 15:
1. ChompText
2. RushHour
3. PulseText
4. PingPong
5. DJPopMenu
6. NavBar
7. 3DMaze
8. Encyclo
9. AnimLetters_anim
10. AScroll2
11. Nibbly
12. SonaliCalendar
13. BMMenu
14. BMI
15. SlideMenu
Want more? Check out our Top 100!

Refer-It
Affiliate Program and Referral Directory.
New on internet.com
Verizon Ordered to Reveal Names of Music Pirates
The U.S. Court of Appeals Wednesday afternoon rejected Verizon's for request for a stay in earlier court ruling ordering the telecom giant to turn over the names of two subscribers suspected of illegally downloading copyrighted music.

E-mail Archiving Emerges as Critical Function
In today's corporate world, e-mail holds a company's critical information. Now a growing number of businesses are realizing that they need to save these e-mails. And they just can't pack them away like receipts you toss in a box at home.

The Deadly Duo: Spam and Viruses, May 2003
Spam attacks increase another 6+% for the month, as the global ratio of unwanted messages in business e-mail breaks the 50% mark.


100's of firms that help your Web site be found

Copyright 2003 Jupitermedia Corporation All Rights Reserved.
Legal Notices,  Licensing, Reprints, & Permissions,  Privacy Policy.
http://www.internet.com/