在java代码中:
// Define ActionListener
ActionListener actionListener = new ActionListener() {
public void actionPerformed(ActionEvent actionEvent) {
JButton button = **(JButton)actionEvent.getSource();**
int red = random.nextInt(255);
int green = random.nextInt(255);
int blue = random.nextInt(255);
button.setBackground(new Color(red, green, blue));
}
};
突出显示(介于**
和之间**
)的代码有什么作用?
我发现研究这个主题非常困难,因为我不知道使用什么搜索词。:o
希望任何人都可以提供帮助。TIA