1   package appletSample;  // NOPMD nimi saa kelvata
2   
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  /**
16   * Sovelma, joka käyttää kuvapaneelia.
17   * @author vesal
18   * @version 28.08.2008
19   */
20  public class FunctionApplet extends EasyApplet {
21  
22      private static final long serialVersionUID = 8729837737198762878L;
23  
24      /**
25       * Alustetaan sovelmalle kuviot.
26       * @see java.applet.Applet#init()
27       */
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