Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

Troubleshooting
Research
Professional Opinions
Ask a Question
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

troubleshooting Question

2 ActionListeners on one button

Avatar of rockymagee
rockymagee asked on
Java
11 Comments1 Solution258 ViewsLast Modified:
I have 2 Listeners that looks like this:

//AHEAD
}else if ("Ahead".equals(e.getActionCommand()) ){
   if(!deviceView.getText().equals("")){
   this.mdate.addMinute();
   clockView.setText(mdate.time(mdate));
}
         
//BACK       
}else if ("Back".equals(e.getActionCommand()) ) {
    if(!deviceView.getText().equals("")){
    this.mdate.subMinute();
    clockView.setText(mdate.time(mdate));
}

The methods addMinute() for "AHEAD" and subMinute() for "BACK" work properly.

What I want to do is call these methods if the button is clicked, but I also have two
other methods that add and subtract 10 minutes to my clockView.  I would like for these
methods to be called if the user clicks and holds on the buttons "Ahead or Back".

Please let me know if I can clarify, I guess my overall question is can I add two different
Listeners to one button that react differenty if the user either just clicks or clicks and holds.

TIA

ASKER CERTIFIED SOLUTION
Avatar of ksivananth
ksivananthFlag of United States of America imageVice President

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Commented:
This problem has been solved!
Unlock 1 Answer and 11 Comments.
See Answers