// File: Writing.java
// T Balls Feb 1998
// Demo of Java Fonts
import java.awt.*;
public class Writing extends Frame
{ public Writing()
{ setTitle( "Writing" );
setSize( 400, 300 );
setVisible( true );
f1 = new Font( "SanSerif", Font.BOLD, 20 );
f2 = new Font( "Serif", Font.ITALIC, 24 );
f3 = new Font( "Monospaced", Font.PLAIN, 30 );
}
Font f1;
Font f2;
Font f3;
public void paint( Graphics g )
{ g.setFont( f1 );
g.drawString( "Hello", 10, 50 );
g.setFont( f2 );
g.drawString( "Hello", 10, 150 );
g.setFont( f3 );
g.drawString( "Hello", 10, 250 );
}
public static void main( String[] args )
{ new Writing();
}
}
|