• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Executing ActionEvent after a ChangeEvent

 
Ranch Hand
Posts: 464
Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
button.doClick();
 
S Venkatesh
Ranch Hand
Posts: 464
Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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??
reply
    Bookmark Topic Watch Topic
  • New Topic