How to detect a non Java program running in fullscreen mode? - java

I am currently developing a Java cross-platform (windows and mac os x) application running in background and displaying a pop-up window on some user's or system's events like "Copy and Paste" or programs' launching.
Nevertheless, I would like to detect first, if any other program, not necessarily developed in Java, is running in full screen mode. In that case, I would not display my window.
For instance, when user is watching a movie in full screen (media player...), a Powerpoint presentation...
So here are my questions :
1. Is there any way to do such a thing in Java language?
2. If it's not possible, I will do my "full screen mode detector" in another language but it has to be able to communicate with my Java app to notify the presence of a full screen window.
3. If it's not possible (1) : do you know the best language to do it? I found other solutions in C# or C++ MFC( How to check if an other program is running in fullscreen mode, eg. a media player ).
Any idea would be very useful.
Thanks a lot.
Sebastian

Eventually I did one external program for each OS which checks if active window is in full screen mode or not and writes the result on standard output. My Java app calls the good program according to the OS and read the result.
I used :
C# for Windows
Carbon for Mac OS X
The hardest part was Mac OS X version.
Don't hesitate to ask me if you're interested in these programs.
Thanks again for your help!

You can capture screen with java.awt.Robot, can you implement algorithm based on screenshot?

The simplest solution is to give the user the option of enabling/disabling your pop-ups. That way they can pick and choose when to receive pop ups.

Related

Objective-C/Java interaction

I have some java code that I use on a windows machine that runs as a service and has a tray icon that I want to port to Mac OS X. From what I can tell there is no good way to make a menu bar icon using java, so I want to basically wrap my java code with objective-c so I can have a nice menu bar icon and still interact with the java code as I am able to when running the code on my windows box. Is there a good way to do this?
My java code makes web requests every so often so the main functionality I'm looking for is to start/stop the web client, as well as receive updates from the java code on the status of the web requests (more or less push notifications).
Thanks for your help everyone!
If all you're trying to do is get your application's icon displayed in the Dock & the Finder, you don't need to write an objective-C wrapper; all you need to do is bundle the Java code up in with the icons in an OS X "application bundle". See Apple's Java Deployment Guide
You might also want to look into the com.apple.eawt package (see questions/1319805/java-os-x-dock-menu), which provides some features to allow a Java app to appear more like a native OS X application to the user (for example, supporting drag-and-dropping a file to the application icon).

How to prevent user close my application? (Linux Touchscreen apps)

I would like to have an application running in a linux box with a touchscreen monitor.
I don't want to use Flash player (with full window size), so my question is, what I should use instead of a Flash Player?
This box is gonna be in a place with a lot of kids, so they can close the application and shutdown the machine XD.
I'm not a Sr. Java developer, so I don't know if theres something over there to block the 'close window' feature in an java application.
Thanks in advance!
Assuming you're using swing, you could use Frame.setUndecorated(true) and maximize it. There is also the option of exclusive full screen mode. From there, you'll have to unbind any global keys that map to window-exiters/taskmanagers/other-utils.
You may also want a watcher/spawner script setup to make sure your app stays up. I bet there is a more elegant way to do this but most window managers try to avoid an app doing this due to malicious possibilities.

Window operation notification in Java

I want my Java program to know when a particular program has its window maximized or minimized or may be is running in exclusive full screen mode(most importantly when not). How to go about it?
If its not possible than only if i know that if any program is running in full screen exclusive mode or not!
Write a WindowListener - this will show you how.
i know its a little late to answer this but have a look at this
In Java Swing how do you get a Win32 window handle (hwnd) reference to a window?
once you have the window handle/reference you can perform operations on the window. Its definitely possible to do this since Spy++ that comes along with Visual Studio does this.

Adjust volume and prevent computer from standby in Java... (Mac and Windows XP, Vista)

I am writing a Java program that wants to do 3 things, and I don't know how to do them or if it's even possible with Java.
1 - I want to ensure that the computer whether running mac OS or windows xp/vista, doesn't go to sleep whilst running my app.
2 - I want my app to be able to turn the volume to full on all of the above OS's before playing a sound.
3 - Finally, when a sound is played I want to make sure that the screen, if turned off for 'power saving', is switched on.
Is any of this possible? I saw this post which suggested javax.sound.* as an answer to (2), but does that work on OS X and Windows XP, Windows Vista?
If anyone knows I would be very grateful.
EDIT: The app is a wi-fi LAN communications program that allows a user using the "client" software to pop up a message on any computer on the network running the "server" software. The software must notify the user even if they are not at the computer, hence the requirements for it to be always on (no support for WOL over wi-fi) and for it to make alot of noise & wake the screen to display any messages.
For part 1, you might want to look at the OnNow/ACPI Support for Windows and the likes of ES_DISPLAY_REQUIRED. Not Java, but you're probably going to have to go native or find a 3rd party wrapper library for this type of control.

Recommended technology choice for desktop application

I am creating an application that is essentially a financial alerts site. I am a basic level Java programmer, and I have created some of the logic for alerts in Java.
I want to be able to have pop-ups appear on the desktop whenever something "interesting" happens (interesting depends on %change, liquidity and a few other simple factors).
What is the best combo of technology to implement something like this?
I would use the java.awt.SystemTray in Java SE 6. It's cross-platform and pretty easy to use.
Although some people hate the balloon notifications in Windows, they're the least obtrusive popups, since they can be ignored by the user or easily dismissed. Most importantly, they can't be missed by the user who has been away from the computer, because balloons (at least in Windows XP/Vista) use system idle timers to determine when's the right time to disappear.
Some prefer more traditional toast notifications, similar to those shown by Outlook - they show up and slowly fade out, giving the user some time to interact with them if needed.
I had the same problem and finally solved it using an undecorated, alwaysOnTop window.
And thanks to this blog entry I found the TimingFramework, and now it even is translucent, fades in and out, goes 100% opaque on mouse over etc. In conjunction with the SystemTray and TrayIcon the behavior is nearly as that of Outlook.
Oh, I have to note, that other than the second link, I do the fading out with
AWTUtilities.setWindowOpacity(window, op);
You could write a java program that resides in the system tray, but I am not sure if there are cross platform compatible ways to do this. maybe you have to use a platform specific library for Win, Mac, Linux, ...
I'd just create a message window and animate it. Then add SystemTray support and voila, you're done.
In Delphi you can do that pretty quickly, but you can't easily reuse your java logic
You can just run you program in "silent" mode, without creating any windows by default, maybe just a little icon in the taskbar which when double-clicked will open a settings window. The program will be running in the background and creating windows with the set focus whenever an event happens.
But in my opinion, a slide window or at least a balloon tooltip is a better idea.

Categories