home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Programming Languages Suite
/
ProgLangD.iso
/
Java++
/
VJ
/
SAMPLES
/
SUN
/
SIMPLEGRAPH
/
GRAPHAPPLET.JAVA
< prev
next >
Encoding:
Amiga
Atari
Commodore
DOS
FM Towns/JPY
Macintosh
Macintosh JP
NeXTSTEP
RISC OS/Acorn
UTF-8
Wrap
Java Source
|
1996-11-11
|
351 b
|
15 lines
import java.awt.Graphics;
public class graphapplet extends java.applet.Applet {
double f(double x) {
return (Math.cos(x/5) + Math.sin(x/7) + 2) * size().height / 4;
}
public void paint(Graphics g) {
for (int x = 0 ; x < size().width ; x++) {
g.drawLine(x, (int)f(x), x + 1, (int)f(x + 1));
}
}
}