Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Executing ActionEvent after a ChangeEvent  RSS feed

 
S Venkatesh
Ranch Hand
Posts: 464
Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I have to execute a Action event on a button after i execute the ChangeEvent on an editor. Currently as soon as i execute the ChangeEvent on a Editor, the ActionEvent on a button is not getting executed at all. Can you please suggest me a way to do it?

Thanks
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
button.doClick();
 
S Venkatesh
Ranch Hand
Posts: 464
Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Michel,

Base class contains an editor. On change event of this editor, i am trying to populate some value to another editor.

A class that extends this base class contains the button.

Now, if the user enters a value on the editor and clicks the button, i need to populate another editor as well as execute the button click event.

This is my exact problem. I feel its clear now.

How to do this?
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
> I feel its clear now.

this is all I can make out of the description

 
S Venkatesh
Ranch Hand
Posts: 464
Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
class Class1{
Editor ed1;
Editor ed2;
Ed1ChangeListener ed1Listener;

Class1(){
//ed1's change listener
ed1Listener = new Ed1ChangeListener();
ed1.addChangeListener(ed1Listener);
}

private class Ed1ChangeListener implements ChangeListener{
public void stateChanged(ChangeEvent e) {
ed2.populateValue();
}
}
}

class Class2 extends Class1{

}

class Class3{
Button b1;
Class2 c2;

public m1(){
b1.addActionListener(new ActionListener() {
//here i want to set the values for ed2 and then also perform the button click operation
public void actionPerformed(ActionEvent e) {
// Do some operation
}
}
}
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
this still doesn't make a lot of sense to me

from your first post:
I have to execute a Action event on a button after i execute the ChangeEvent on an editor.

from your last post:
//here i want to set the values for ed2 and then also perform the button click operation.
and in 'Ed1ChangeListener'
ed2.populateValue();


so, it seems the changeListener will 'set the values for ed2',
but from your second post:
Now, if the user enters a value on the editor and clicks the button,


if it does all happen from the button click, it would be just

public void actionPerformed(ActionEvent e) {
c2.ed2.populateValue();//then
// Do some operation
}

but then the changeListener would not be required??
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!