I want to use the first ActionListener (About) into the second ActionListener (About2)
without copying the first one into teh second one are there any way to do that?
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///////////////
}
}
);
Well as long as you’re not using the
ActionEventargument, you could just create a method like this in your class,and in your
actionPerformedmethods, just callSo like this,