2 messages in net.java.dev.jna.usersRe: [jna-users] JNA - java.lang.Illeg...
FromSent OnAttachments
Peach WyssApr 14, 2009 3:46 am 
Timothy WallApr 14, 2009 4:01 am 
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:Re: [jna-users] JNA - java.lang.IllegalArgumentException: Component must be heavyweightActions...
From:Timothy Wall (twal@dev.java.net)
Date:Apr 14, 2009 4:01:05 am
List:net.java.dev.jna.users

Heavyweight components have a native window resource attached. Lightweight ones make use of an ancestor heavyweight component's native window resource, and rely on Swing to manage the content.

Since VLC is ignorant of any management Swing performs on a native window resource, it is best to use a heavyweight component dedicated just to VLC (or any other native application).

If wonderland has problems with heavyweight components, it'll have problems with anything VLC does as well. You could have it draw to an offscreen drawable and copy the bits out to a JPanel, but that's probably a lot more native API than you're willing to get into.

On Apr 14, 2009, at 6:47 AM, Peach Wyss wrote:

Hello

I've tried to use jna (inside jVLC -> java bindings for the vlc player) with a jpanel:

public void setVideoOutput(JPanel jpanel) { long drawable = Native.getComponentID(jpanel); libvlc_exception_t exception = new libvlc_exception_t(); libvlc.libvlc_video_set_parent(instance, drawable, exception ); }

Then I get the following error: Exception in thread "AWT-EventQueue-0" java.lang.IllegalArgumentException: Component must be heavyweight at com.sun.jna.Native.getComponentID(Native.java:156)

I had problems using the heavyweight canvas object inside my sun's wonderland embeddedswing application, so I tried it with a lightweight jpanel instead of a canvas object. Is it not possible to use JNA with a lightweight component such as a jpanel?

Thanks for your help. Peter