第 3 行关键字ActionListener()
后面的含义是什么new
?我知道这是匿名类的结构,但我不明白。
Button okButton = new Button("Open a Frame");
okButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
statusLabel.setText("A Frame shown to the user.");
frame.setVisible(true);
}
});
Run Code Online (Sandbox Code Playgroud) java ×1