我想将第一个 ActionListener (About) 用于第二个 ActionListener (About2) 而不将第一个 ActionListener 复制到第二个中,有什么办法吗?
About.addActionListener(new ActionListener(){
@Override
public void actionPerformed(ActionEvent ae){
AboutMe.setLocation(470,250);
AboutMe.setSize(400, 200);
AboutMe.setVisible(true);
AboutMe.setResizable(false);
AboutMe.add(panel5);
panel5.setLayout(null);
panel5.add(ta);
ta.setBounds(15, 15, 350, 130);
ta.setBorder(BorderFactory.createEtchedBorder());
ta.setText("...................................\n"
+ "....................................\n"
+ "....................................\n"
+ "....................................\n"
+ "....................................");
ta.setEditable(false);
}
}
);
About2.addActionListener(new ActionListener(){
@Override
public void actionPerformed(ActionEvent ae){
////////code here///////////////
}
}
);