📄 chapter4.java
字号:
/*@author 邱宇峰 ,software project031,
*2004,11,8
*/
import java.awt.*;
import java.awt.event.*;
public class chapter4 extends Frame implements ActionListener,ItemListener{
static chapter4 frm=new chapter4();
static Graphics g;
static Panel pl;
static Button b;
static Label l;
static TextField tf;
static Choice ch=new Choice();
public static void main(String[] args){
ch.add("SelfAdopt1 calculate((sinx)/x)'s integral");
ch.add("SelfAdopt2 calculate(sin(x)*sin(x)+1)'s integral");
ch.addItemListener(frm);
frm.setTitle("第4章");
l=new Label("current acerage is");
tf=new TextField(15);
pl=new Panel();
pl.setLayout(new FlowLayout());
b=new Button("clean");
b.addActionListener(frm);
pl.setLayout(new FlowLayout());
pl.add(b); pl.add(l); pl.add(tf);
frm.add(ch,"North");
frm.add(pl,"South");
frm.setSize(800,500);
frm.setVisible(true);
frm.addWindowListener(new WindowAdapter(){public void windowClosing(WindowEvent e){System.exit(0);}
});
g=frm.getGraphics();
}
public void actionPerformed(ActionEvent e){
Graphics g=getGraphics();
repaint();
tf.setText("");
}
public void itemStateChanged(ItemEvent e){
int index=ch.getSelectedIndex();
call4 cal=new call4();
cal.act(index,g,tf);
}
}
class call4{
void act(int choice,Graphics g,TextField tf){
switch(choice){
case 0:integral1 integrate=new integral1(); integrate.calculate(g,tf);break;
case 1:subsectionIntegral1 subI=new subsectionIntegral1(); subI.calculate(g,tf); break;
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -