mrynit 0 Newbie Poster

In my GUI class I am trying to make an instace of my ToolAction class, which extends AbstractAction. The compiler says

The constructor ToolAction(String, int, PowerPaintDrawingPanel, GeneralPath) is undefined PowerPaintGUI.java line 109

which means my below attempt make an object of ToolAction does not work beacuse the arguments of my constructor call in my GUI class do not match the expected arguemenst in the ToolAction constructor. action_list.add(new ToolAction("Pencil", KeyEvent.VK_P, my_drawing_panel, new GeneralPath()));

public ToolAction(final String the_name, final KeyEvent the_keyevent,
                    final PowerPaintDrawingPanel the_drawing_panel, final Shape the_shape)
  {
    super(the_name, new ImageIcon(ClassLoader.getSystemResource("powerpaint/icons/" +
                                                                the_name + "_bw.gif")));
    
    putValue(Action.SHORT_DESCRIPTION, "Select the " + the_name + " tool");
    putValue(Action.MNEMONIC_KEY, the_keyevent);
    
    my_drawing_panel = the_drawing_panel;
    my_shape = the_shape;
  }

I have figured out that the issue is KeyEvent, ever other argument works. putValue(Action.MNEMONIC_KEY, the_keyevent); needs an object type as the second paramater. If I put a KeyEvent.VK_P in there it works, but if I pass KeyEvent.VK_P into the_keyevent it wont work! I don't understand why that is. To fix this I did final Integer the_keyevent . So this converts the int from KeyEvent into an Integer object which statisfies the requirements for putValue.