addActionListener(this) 中的this问题public class JP extends JFrame implements ActionListener{JPanel panel1=new JPanel();.panel2.add(A=new JButton("7"));.A.addActionListener(this);.}1.这个this是调用当前对象? 2.如果我不想用“this”

来源:学生作业帮助网 编辑:作业帮 时间:2024/05/01 07:46:06
addActionListener(this) 中的this问题public class JP extends JFrame implements ActionListener{JPanel panel1=new JPanel();.panel2.add(A=new JButton(

addActionListener(this) 中的this问题public class JP extends JFrame implements ActionListener{JPanel panel1=new JPanel();.panel2.add(A=new JButton("7"));.A.addActionListener(this);.}1.这个this是调用当前对象? 2.如果我不想用“this”
addActionListener(this) 中的this问题
public class JP extends JFrame implements ActionListener{
JPanel panel1=new JPanel();
.
panel2.add(A=new JButton("7"));
.
A.addActionListener(this);
.
}
1.这个this是调用当前对象?
2.如果我不想用“this” 可以换成什么?(这个是为了更深入的了解this,请仔细回答,谢谢)

addActionListener(this) 中的this问题public class JP extends JFrame implements ActionListener{JPanel panel1=new JPanel();.panel2.add(A=new JButton("7"));.A.addActionListener(this);.}1.这个this是调用当前对象? 2.如果我不想用“this”
this就是指的对象本身嘛,换成A试试