1

I have made a Screen Recorder using Java Swing and Xuggler 5.4. I have developed it in Windows 8 64 bit. It's working excellent for Windows. But at client side on Linux's environment , nothing is working. I have searched thoroughly but not getting any solutions. I have checked this thread , but it didn't work for me.

Then I tried to create simple Transparent window in Linux but it's also not working. I was not able to click through the Resizeable Panel. I have used the same JRE version (1.7) for both. Have I miss understood Java's Cross Platform Support as far as Swing is concerned? Please Give Me Some Advice...

Community
  • 1
  • 1
tarkikshah
  • 534
  • 6
  • 16
  • 2
    *" Am I miss understood Java's Cross Platform Support as far as Swing is concerned?"* No, but `Xuggler` is a wrapper to a native library, so that raises a question. A lot of functionality that Swing/Java uses relies on the ability for the underlying platform to supply support for it. If the OS doesn't support it, or has no relative concept, then there is simply no way Java can support that feature. For example, the `GraphicsDevice` has `isWindowTranslucencySupported`, which takes `TRANSLUCENT` or `PERPIXEL_TRANSLUCENT` to determine support for transparent window features – MadProgrammer Jul 29 '14 at 06:24
  • But I have just made a Test code that make frame Transparent which is working for the Windows but not for Linux..I am able to click through the frame in windows but not in Linux – tarkikshah Jul 29 '14 at 06:28
  • But at the end of the day, we are at the mercy of what the underlying OS is capable of. Does your window have any mouse listeners attached to it (or attached to any components within the frame)? – MadProgrammer Jul 29 '14 at 06:30
  • Look back to Java 5, for example, the API is pretty bland, very basic functionality which could be provided to just about all platforms. Jav 6 introduced the concept of the `SystemTray`, but not all platforms have a concept of a "System Tray". It also introduced transparent/translucent/shaped windows, again, a concept that is not available to all platforms, so all of sudden we have a graying of this abstract layer, where some features "might" work, "some" of the time. `Desktop` is another example of functionality we would "like" but may not be possible on all platforms... – MadProgrammer Jul 29 '14 at 06:34
  • Yes..JPanel I am using for capturing Screen is Resizable so have attached MouseListener to it – tarkikshah Jul 29 '14 at 06:34
  • Try removing all the mouse listeners and see if that changes anything on Linux... – MadProgrammer Jul 29 '14 at 06:34
  • But removing Mouse Listener makes application useless too. If a capture area can't be resized or dragged then its not of worth.. Still I will check just shake of my understanding regarding to OS supports.. But it's not a solution for my application – tarkikshah Jul 29 '14 at 06:37
  • Best start with a minimal test case. Start with an empty frame and determine if making it transparent will allow you to click through it. Then try adding a `MouseListener`/`MouseMotionListener` to it and see if there is any difference... – MadProgrammer Jul 29 '14 at 06:38
  • 1
    You see, one idea might be to start up the "selection" portion, which would allow you to define the area you want to capture, but then hide the window once the selection has been defined...not sure if that's a workable idea or not, but it's an idea... – MadProgrammer Jul 29 '14 at 06:39
  • Also, I assume your version of Linux meets the minimum requirements for the Xuggler libraries... – MadProgrammer Jul 29 '14 at 06:45
  • I have made simple code just for Transparent Window but its not working... no listeners or nothing .... I am not able to click through.. "setUndecorated(true); setBackground(new Color(0,0,0,0));" , I have used that make it Transparent and Clickable for Windows – tarkikshah Jul 29 '14 at 06:57
  • Okay, so it's an issue with Linux – MadProgrammer Jul 29 '14 at 06:59
  • Would you guide for making transparent screen on Linux machine ? some sample code ? – tarkikshah Jul 29 '14 at 07:05
  • Well, I was just reading [this post](http://stackoverflow.com/questions/11217660/java-making-a-window-click-through-including-text-images) which says they could create a transparent window that was "click throughable"... – MadProgrammer Jul 29 '14 at 07:06
  • I also did this [example](http://stackoverflow.com/questions/20808331/creating-a-jframe-you-can-click-through) some time ago, but I've never tested it on Linux – MadProgrammer Jul 29 '14 at 07:09
  • Checked yours.. Working perfectly for windows but not for Linux.. :( – tarkikshah Jul 29 '14 at 07:14
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/58217/discussion-between-madprogrammer-and-tarkikshah). – MadProgrammer Jul 29 '14 at 07:15

1 Answers1

0

I have always found logging to be the best debugging tool at your disposal! Many a times, java debuggers take you into APIs where you need not go every time. Logging values of your variables, and generic 'I have reached till this point' statements make life a lot easier.

So, I suppose you have ample logging done in your code. That could give you clues on what's happening on your client's system. Are the right environment variables set? Are they pointing to the correct Java versions you need. If there are some specific Screen capturing requirements(plugins / modules / API) your code has, are they available on the Linux m/c? Like @MadProgrammer said, in the end, Java has to talk with the native graphics APIs to render your screen. I would try to debug it in this way -

  1. Check whether my main screen loads or no(by disabling the screen capture functions for a while).
  2. if not, dig deeper.
  3. Check whether all necessary components for capturing screen(audio and video) are available.
  4. Check whether the code is being run with appropriate permissions to control the h/w devices you may need.
Ravindra Mijar
  • 1,282
  • 2
  • 9
  • 17
  • I have added logger but the thing is If some portion is not working I can get from logger. But here nothing is working properly:( .. I have tried just to make simple Transparent screen no xuggler nothing just swing..But it works differently on both system – tarkikshah Jul 29 '14 at 07:02