Page 1 of 1

VLCJ and window without decorations

Posted: 11 Jul 2011 14:41
by mnn
Hi, is it possible to have a window which contains panel, in which VLCJ plays a video, but having the window without decorations?

I tried using setUndecorated(true) on JFrame, but the video isn't rendered at all.

I tried using JWindow and still no video rendered at all.

Just a remainder: I don't want fullscreen - only decorationless window.

Re: VLCJ and window without decorations

Posted: 11 Jul 2011 17:51
by sherington
An undecorated, non-full-screen JFrame works just fine for me. The video plays without any problems. I use Ubuntu 11.04.

Post a single class test case of what doesn't work, and post your OS and vlc/vlcj versions.

Re: VLCJ and window without decorations

Posted: 11 Jul 2011 20:04
by mnn
OK, I separated enough code to make a sample, but that works :(

Apparently VLCJ doesn't like if the video canvas is in a panel, which is located in another panel, and that panel is located in a JFrame (so JFrame -> JPanel -> JPanel -> Canvas (VLCJ)). I tried to cut one panel, and it works (without decorations).

Edit: The bug is (surprise, surprise) in Swing. When the JFrame is decorationless, inner panel (which contains Canvas) ignores all orders to set its sizes (setSize, setMinimumSize...), when they're called from JFrame's ComponentListener's componentResized first call (e.g. when JFrame is being shown).

By ignored I mean that the same calls make impact, when JFrame has decorations... but when it doesn't the JPanel has size of [0,0].

As always, Sun shows how "great" Swing is...

Re: VLCJ and window without decorations

Posted: 11 Jul 2011 20:32
by sherington
Apparently VLCJ doesn't like if the video canvas is in a panel, which is located in another panel, and that panel is located in a JFrame (so JFrame -> JPanel -> JPanel -> Canvas (VLCJ)).

Edit: The bug is (surprise, surprise) in Swing. When the JFrame is decorationless, inner panel (which contains Canvas) ignores all orders to set its sizes (setSize, setMinimumSize...), when they're called from JFrame's ComponentListener's componentResized first call (e.g. when JFrame is being shown).

As always, Sun shows how "great" Swing is...
Hmm... I have "decorationless" JFrame -> JPanel (content Pane) -> JPanel -> JPanel -> Canvas (vlcj). Works just fine. I wouldn't be so quick to denigrate Sun engineers or Swing.

What OS are you using? Maybe it's a platform-specific bug, if you're sure it's not your bug... :D

Re: VLCJ and window without decorations

Posted: 12 Jul 2011 00:25
by mnn
Hmm, OK, it might be Windows-specific bug, but I kind of doubt that.

I mean if I comment out line this.setUndecorated(true) in JFrame constructor, suddenly panel gets resized correctly. That sounds like a bug to me.

Re: VLCJ and window without decorations

Posted: 12 Jul 2011 08:05
by sherington
Well maybe you are triggering a bug. But I don't see that bug under the circumstances you describe, at least not on Linux.