1 package appletSample;
3 import static java.lang.Math.PI;
4
5 import java.awt.Color;
6
7 import fi.jyu.mit.graphics.Axis;
8 import fi.jyu.mit.graphics.EasyApplet;
9 import fi.jyu.mit.graphics.FunctionMapRR;
10 import fi.jyu.mit.graphics.Polynom;
11 import fi.jyu.mit.graphics.SinFun;
12 import fi.jyu.mit.graphics.SpacePanel;
13
14
15
20 public class FunctionApplet extends EasyApplet {
21
22 private static final long serialVersionUID = 8729837737198762878L;
23
24
28 @Override
29 public void init() {
30 SpacePanel panel = getPanel();
31 panel.scale(-7,-2,8,7);
32 panel.add(new Axis(13, 100, 10));
33 panel.add(new FunctionMapRR(SinFun.sin,-2*PI,2*PI,0));
34 panel.add(new FunctionMapRR(new Polynom(1,0,0),-4,4,0)).setColor(Color.RED);
35 panel.add(new FunctionMapRR(new Polynom(1,3,0,0),-4,4,0)).setColor(Color.GREEN);
36 panel.add(new FunctionMapRR(new Polynom(0.5,2,1,-1,-1),-4,4,0)).setColor(Color.ORANGE);
37 }
38
39 }
40