在applet中我使用的是button
。点击一个按钮可以设置三个标签吗?
答案 0 :(得分:5)
你的意思是这样吗?
int count = 0;
String[] texts = new String[] {"Text 1", "Text 2", "Text 3"};
yourButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent ae) {
if(count < 3) yourLabel.setText(texts[count]);
count++;
}
});