public class ClickButton extends JFrame {
private JPanel jp=new JPanel();
private JButton jb1=new JButton("jb1");
private JButton jb2=new JButton("jb2");
private JButton jb3=new JButton("jb3");
private JButton[] jb=new JButton[]{jb1,jb2,jb3};
private JLabel jl=new JLabel("label");
private int count=0;
public ClickButton(){
for(int i=0;i<jb.length;i++){
jp.add(jb[i]);
}
jp.add(jl);
this.add(jp);
this.setTitle("good,actionlistener");
for(int i=0;i<jb.length;i++){
jb[i].addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
if(e.getSource()==jb1)
ClickButton.this.jl.setText("点击了按钮1,合计"+(++count)+"次");
if(e.getSource()==jb2)
ClickButton.this.jl.setText("点击了按钮2,合计"+(++count)+"次");
if(e.getSource()==jb3){
ClickButton.this.jl.setText("点击了按钮3,合计"+(++count)+"次");
}
}
});
}
this.setBounds(200, 200, 200, 20);
this.setVisible(true);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
new ClickButton();
}
}
[color=red][size=x-large]其中ClickButton.this.jl.setText是什么意思,请麻烦详细讲一下,谢谢[/size][/color]