You'll find the JNI code here:
SWT: The Standard Widget Toolkit[
^]
I know SWT is not Swing - but SWT has the required JNI code.
Remember that Swing is built on top of the original objects and framework of AWT.
Inside the $(JDK)\include folder you'll find jawt.h
Inside the $(JDK)\include\win32 you'll find jawt_md.h
jawt_Win32DrawingSurfaceInfo allows you to access the native window handle.
Try subclassing the window using
SetWindowLongPtr[
^] with GWLP_WNDPROC
Here is an example:
Windows subclassing and hooking with C++ classes[
^]
You'll need to update the example code as shown in the comments by Member 3644181
I've found that
Jace[
^] works nicely - It eases JNI development.
Best regards
Espen Harlinn