Questions tagged [abstract-action]

Defines an Action object with a default description string and default icon.

25 questions
1
vote
3 answers

Why doesn't AbstractAction implement actionPerformed()?

Class AbstractAction implements interface Action, but in Action, there's a method actionPerformed(ActionEvent e) which inherits from interface ActionListener I know that the class implements an interface must supply all the implementations of…
Bin_Z
  • 899
  • 1
  • 10
  • 15
0
votes
0 answers

Have an Abstract Action wait for a Mouse Event?

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…
1288Meow
  • 319
  • 2
  • 7
0
votes
1 answer

Switch Case In ActionPerformed?

Ive gone through some stack overflow questions and found this similar question. From what I understand using a switch statement in an actionPerformed method for this context will not work and an if-else statement is required. Is there a more…
0
votes
1 answer

Special method should be called after any AbstractAction-execution

Please excuse the vague question title, but usually I don't do such kind of stuff. So I have the following problem: I'm designing a popupmenu for a specific app where each menu item is associated with a certain action: public class CanvasMenu…
phimuemue
  • 34,669
  • 9
  • 84
  • 115
0
votes
1 answer

How to find KeyCode of pressed Key

I would like to have 2 buttons: 1) BindBTN - When clicked a keyListener/action will listen for key press and find the KeyCode of that key. 2) RunBTN - When clicked an action will wait until the user presses the same key and then preforms…
0
votes
1 answer

Why I cant disable a toolbar button (action) using setEnabled(false)

I have toolbar button, that I am trying to disable by using action.setEnabled(false), but when I do it I am getting the following error: java.lang.IllegalStateException: This must happen in the event thread! at…
Camilo Guevara
  • 165
  • 1
  • 12
0
votes
1 answer

Implementation of AbstractAction in the MVC model

I'm developing a MVC Java Swing application, which will offer the user at least a dozen of different actions. Some of these actions will trigger execution of a SwingWorker object, while others are pretty simple (or common). I started with the…
serkelion
  • 73
  • 2
  • 8
0
votes
1 answer

KeyListener inside an Action Class Not heard when using setAction()

I'd appreciate any advice to how I can get the following to work. Originally all my actions were stuffed into the GUI. Then the GUI became quite large as the project progressed. So I've been moving all these actions into their own classes. In…
chin-apse
  • 25
  • 5
0
votes
3 answers

Right way to compose an action as a sequence of multiple smaller actions?

I have three actions defined like so: public class A extends AbstractAction; public class B extends AbstractAction; public class C extends AbstractAction; Now I want to define a jumbo action that does these three actions in order. I am sure there…
Moeb
  • 10,527
  • 31
  • 84
  • 110
0
votes
1 answer

Calling outer class' method getContentPane() from inner Action class

I want to call outer class' method getContentPane() from inner Action class. I don't understand why my code doesn't work. public class MainFrame extends JFrame { public MainFrame() { super("My app"); JMenuBar menuBar = new…
Dmitry Zhlobo
  • 369
  • 2
  • 10
1
2