# G4P GUI: cannot find KeyEvent method

**URL:** https://discourse.processing.org/t/g4p-gui-cannot-find-keyevent-method/36404
**Category:** Libraries
**Created:** [April 18, 2022, 3:19am UTC](https://discourse.processing.org/t/g4p-gui-cannot-find-keyevent-method/36404 "2022-04-18T03:19:20Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Ignotus](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/ignotus/32/14922_2.png) [@Ignotus](https://discourse.processing.org/u/Ignotus)
#### Post date: [April 18, 2022, 3:19am UTC](https://discourse.processing.org/t/g4p-gui-cannot-find-keyevent-method/36404/1 "2022-04-18T03:19:20Z")

</div>

I am getting an error on running G4P V4.3.8.

> The GWindowAWT class cannot find this method  
> public void winMouse(PApplet applet, GWinData windata, MouseEvent ouseevent) { /\* code \*/ }
> 
> The GWindowAWT class cannot find this method  
> public void winKey(PApplet applet, GWinData windata, KeyEvent eyevent) { /\* code \*/ }

The app runs, putting up a main animation window and a subsidiary window of G4P controls. Everything works, including numerous event handlers, but the mouse events and key events in the control window can’t be caught.

I have tried running similar handlers in a much small app–there it all works. The handlers for key and mouse events are present and properly formatted, and I checked the file for bogus characters. There were none.

Here’s a typical handler:

```auto
synchronized public void winKey(PApplet appc, GWinData data, KeyEvent kevent) { 
  println("ControlWindow - key event " + millis());
} 

```

At this point, I’d welcome suggestions.

---

<div class="post-metadata">

### Author: ![Ignotus](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/ignotus/32/14922_2.png) [@Ignotus](https://discourse.processing.org/u/Ignotus)
#### Post date: [April 18, 2022, 5:35pm UTC](https://discourse.processing.org/t/g4p-gui-cannot-find-keyevent-method/36404/2 "2022-04-18T17:35:10Z")

</div>

Posted the problem and then I solved it. Typical.

Because I had also imported `java.awt.event.*` to my app, the signature for the `winKey` method was misconstrued by the JRE (or so I surmise). By explicitly citing the type:

```auto
synchronized public void winKey(PApplet appc, GWinData data, processing.event.KeyEvent kevent) { 
  println("ControlWindow - key event " + millis());
} 

```

Problem solved.
