title: In Java Swing how do you get a Win32 window handle (hwnd) reference to a window?
body: <p>In Java 1.4 you could use ((SunToolkit) Toolkit.getDefaultToolkit()).getNativeWindowHandleFromComponent() but that was removed.</p>
  
  <p>It looks like you have to use JNI to do this now. Do you have the JNI code and sample Java code to do this?</p>
  
  <p>I need this to call the Win32 GetWindowLong and SetWindowLong API calls, which can be done via the Jawin library.</p>
  
  <p>I would like something very precise so I can pass a reference to the JDialog or JFrame and get the window handle.</p>
  
  <p><a href="https://stackoverflow.com/questions/265602/swing-transparency-using-jni">Swing transparency using JNI</a> may be related.</p>