小编Nil*_*dav的帖子

new ActionListener() 是什么意思?

第 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

-2
推荐指数
1
解决办法
1623
查看次数

标签 统计

java ×1