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.
Related
I was wondering how to make like one of those silent programs that run on your desktop but at the same time doesn't show a picture in your taskbar in the bottom?
This is kind of hard to explain since my experience is limited to making GUIs that show up in the taskbar and has the top bar with the minimize, maximize, and close buttons.
I want to make a program running that is something like this:
See those boxes? How would I create something like that with Java?
You can use translucent windows in Java: http://docs.oracle.com/javase/tutorial/uiswing/misc/trans_shaped_windows.html
It will depend on the capabilities of the platform (that you can query for). You will probably need at least per-pixel transparency, if not translucency. No idea if they are supported on both Windows 7 and Mac, you have to try.
Multi-window applications often have a main-window, and all other windows are kind of 'parented' to it. Minimizing such a sub-window will hide its content and show the title-bar at the bottom-left of the screen. Also, these windows do not have their own Icon in the Task-bar, only the main-window does.
How can I make a window being attached this way to another window?
If that is possible, is it also possible without a referenfe to the actual main window?
#2: I'm embedding Java into such an application and I would like to be able to use awt or swing additionally to the native dialogs, which have this behavior by default.
See How to Use Internal Frames.
have look at JInternalFrames for MDI application
read Oracle tutorial, try code example
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.
I'm looking for a push in the right direction. I have a simple chat program, written totally in Java, and am looking for a way to get the Taskbar icons to flash. Preferably in a manner similar to Pidgin, or MSN.
I'm hoping for a platform independent solution, as there are both Linux and Windows users, and preferably totally in Java.
There is unfortunately no way to do this in the standard Swing API. But you could work around it in several ways:
Flash the icon and title of the window (set a timer and change them whenever it fires).
Request focus, then immediately make the window invisible; reverse the process at your preferred interval.
Both techniques are demonstrated in this forums.sun.com thread.
Alternatively, instead of flashing, you could display a message in the system tray using TrayIcon.displayMessage(); that may or may not suit you better, but beware that it may not work cross-platform.
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.