// The copyright of this program is reserved by “N”L.
/*
sin(x)‚ĚMacLaurin“WŠJ
*/
/* */
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class Ex060924b extends JApplet implements ActionListener{
boolean flag=false;
double h=0.01;
JComboBox cb;
int num = 0;
String cbl[]={"n=0","n=1","n=2","n=3","n=4","n=5"};
public void init(){
Container cp =getContentPane();
JPanel pl = new JPanel();
pl.setBackground(Color.black);
cb = new JComboBox(cbl);
cb.setBounds(80,0,60,20);
cb.setSelectedIndex(0);
cb.addActionListener(this);
pl.setLayout(null);
pl.add(cb);
cp.add(pl);
}
public void actionPerformed(ActionEvent event){
num = cb.getSelectedIndex()+1;
flag=true;
repaint();
}
public void paint(Graphics g){
super.paint(g);
g.setColor(Color.blue);
g.drawLine(0,100,320,100);
g.drawLine(160,0,160,200);
if(flag==true)
for(double x=-Math.PI;x