how to activate another actionlistener within an actionlistener

e.g. im now handling the codes for the button A's listener. is it possible within this actionlistener, that I actually activate another button B's actionlistener through codes even though i did not physically clicked button B?Please HELP!!
[262 byte] By [gemithya] at [2007-10-2 8:30:07]
# 1
http://java.sun.com/j2se/1.5.0/docs/api/javax/swing/AbstractButton.html#doClick()
ajneoa at 2007-7-16 22:30:56 > top of Java-index,Desktop,Core GUI APIs...
# 2

move the code from B's actionListener into it's own method, which will be

called by B, and can be called by A

eg

instead of

b.addActionListener(new ActionListener(){

public void actionPerformed(ActionEvent ae){

System.out.println("Hello World");}});

you have this

b.addActionListener(new ActionListener(){

public void actionPerformed(ActionEvent ae){

doSomething();}});

public void doSomething()

{

System.out.println("Hello World");

}

now, doSomething() is available to be called from A

Michael_Dunna at 2007-7-16 22:30:56 > top of Java-index,Desktop,Core GUI APIs...