当前位置: 技术问答>java相关
applet的小问题,就是有点不懂,谢谢了
来源: 互联网 发布时间:2015-08-02
本文导语: //请大家看一下这断代码 import java.applet.*; import java.awt.*; import java.awt.event.*; public class Greetingapplet extends Applet implements ActionListener{ private boolean isStandalone = false; private Label prompt; private Label greeting; ...
//请大家看一下这断代码
import java.applet.*;
import java.awt.*;
import java.awt.event.*;
public class Greetingapplet extends Applet implements ActionListener{
private boolean isStandalone = false;
private Label prompt;
private Label greeting;
private TextField inputLine;
public Greetingapplet() {
prompt = new Label("Please enter your name: ");
greeting = new Label();
inputLine = new TextField();
add(prompt);
add(greeting);
add(inputLine);
inputLine.addActionListener(this);//给我通俗的讲一下好吗,我不大明白这个事件
}
public void actionPerformed(ActionEvent event ){
greeting.setText("Nice to meet you," + inputLine.getText()+".");
add(greeting);
doLayout();
}
}
/**给我讲一下这个里面的事件好吗?
1。implements?
2。ActionListener?
谢谢
*/
import java.applet.*;
import java.awt.*;
import java.awt.event.*;
public class Greetingapplet extends Applet implements ActionListener{
private boolean isStandalone = false;
private Label prompt;
private Label greeting;
private TextField inputLine;
public Greetingapplet() {
prompt = new Label("Please enter your name: ");
greeting = new Label();
inputLine = new TextField();
add(prompt);
add(greeting);
add(inputLine);
inputLine.addActionListener(this);//给我通俗的讲一下好吗,我不大明白这个事件
}
public void actionPerformed(ActionEvent event ){
greeting.setText("Nice to meet you," + inputLine.getText()+".");
add(greeting);
doLayout();
}
}
/**给我讲一下这个里面的事件好吗?
1。implements?
2。ActionListener?
谢谢
*/
|
v