Basic HTML version of Foils prepared Sept 21 1998

Foil 21 An Image Drawing Example

From Java Tutorial 98- 3: Graphics and the Abstract Windowing Toolkit NAVO Tutorial -- Sept 23 1998. by Geoffrey C. Fox, Nancy McCracken

An image example
1 This example shows how to get the actual height and width of the image to use in scaling the image under java program control.
2 import java.awt.*
3 public void class Drawleaf extends java.applet.Applet
4 { Image leafimg;
5 public void init ( )
6 { leafimg = getImage(getCodeBase( ),"images/Leaf.gif");
7 }
8 public void paint ( Graphics g )
9 { g.setFont ( theFont );
10 g.drawString ( theDate.toString ( ), 10, 50 );
11 }
12 }

in Table To:


© Northeast Parallel Architectures Center, Syracuse University, npac@npac.syr.edu

If you have any comments about this server, send e-mail to webmaster@npac.syr.edu.

Page produced by wwwfoil on Sat Nov 28 1998