- public class myapplet extends Applet
- implements ActionListener
- {
- TextArea area;
- Label ccc;
- TextField name1,name2;
- Button btn;
- String c1,c2,c3;
- public void init()
- {
-
- name1=new TextField(8);
- ccc=new Label("替换成");
- name2=new TextField(8);
- btn=new Button("确定");
- area=new TextArea(4,20);
- add(name1);
- add(ccc);
- add(name2);
- add(btn);
- add(area);
- btn.addActionListener(this);
- }
- public void actionPerformed(ActionEvent e)
- {
- if(e.getSource()==btn)
- c1=name2.getText();
- c2=name1.getText();
- c3=new String(area.getText());
-
- System.out.println(area.setText(c3.replace(c1,c2)));
-
- }
- }
复制代码 为什么运行后 告诉我 Sytem.out.println(area.steText(c3.replace(c1,c2)));
↑
此处不能为空 |
|