Java Reference
In-Depth Information
// y = 1 - 4 * (t - .5)**2;
Function ft =
new Arithmetic('-', new T(), new Constant(.5));
Function y =
new Arithmetic(
'-',
new Constant(1),
new Arithmetic(
'*',
new Constant(4),
new Arithmetic('*', ft, ft)));
p.setXY(x, y);
com.oozinoz.ui.SwingFacade.launch(
p, " Flight Path");
}
}
Figure 27.6 shows the results of this code, as well as the following code, which plots a circle
without requiring a new class:
package com.oozinoz.applications;
import com.oozinoz.function.*;
public class ShowFunZone
{
public static void main(String args[])
{
FunPanel p = new FunPanel();
p.setPreferredSize(
new java.awt.Dimension(200, 200));
Function theta =
new Arithmetic(
'*',
new Constant(2 * Math.PI),
new T());
Function x = new Cos(theta);
Function y = new Sin(theta);
p.setXY(x, y);
com.oozinoz.ui.SwingFacade.launch(p, " Dud Zone");
}
}
Search WWH ::




Custom Search