K
K
Klin Klinom2014-09-29 17:03:46
Java
Klin Klinom, 2014-09-29 17:03:46

How to assign different actionPerformed to it when clicking on one button (Java + NetBeans)?

Hello!
Essence of the question:
It is necessary to perform different actions when pressing the same button.
With actionPerformed - one action can be performed. And you need to make it work like this:
the first click is one action (for example, changing the picture in the jFrame window), the second is the second action (changing to the second picture in the window).
Maybe there is some other event? And is this even possible?
4bce6f55a4d28e140796bb32fcc2e8941b5e5aec
Thank you!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
Nikita, 2014-09-30
@yramarad31

Make a tick (boolean) or a counter of clicks and, depending on its value, do the necessary action.
In general, since you are such a beginner, it is contraindicated for you to use visual editors.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question