0

I am trying to write an AbstractAction class which waits for a mouse click event and then processes the Object clicked. Is there a relatively simple way to do this?

Also, if the user clicks the wrong type of object, would like to ask the user to try again.

private class MyAction extends AbstractAction implements EventListener {

    MyAction() {
        super("Do something...");
    }

    /**
     *
     */
    public void actionPerformed(ActionEvent arg0) {
            // Wait for User to click to select Object
            Object o = ...;
            // Do something with object that was clicked/selected
    }
    
}
1288Meow
  • 319
  • 2
  • 7
  • 3
    You never want to "wait" in a program that uses an event-driven programming paradigm and instead should have the program alter the behavior of its listeners depending on its state. As for your specific problem, if you don't get a decent answer soon, consider telling and showing more details of the problem, including possibly an [mre] program code post with the question. – Hovercraft Full Of Eels Apr 14 '22 at 17:16
  • Thank you! Your comment really helped me think of the problem in a different way and I was able to find a solution. – 1288Meow Apr 15 '22 at 09:10

0 Answers0