Waveletpublic class Wavelet extends Applet Simple Applet demo, showing a math function. |
Methods Summary |
---|
double | func(double x)This is the function that is plotted.
Dimension d = getSize();
return (Math.cos(x/9) + Math.sin(x/3) + 1) * d.height / 4;
| public void | paint(java.awt.Graphics g)Called by AWT when the window needs painting; just recompute
all the data and draw it, since it's a simple calculation and
simpler than precomputing and storing the data.
Dimension d = getSize();
for (int x = 0 ; x < d.width ; x++) {
g.drawLine(x, 20+(int)func(x), x + 1, 20+(int)func(x + 1));
}
|
|