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.
Related
I'm looking for a really simple widget: tree view on the left pane, folder contents on the right, switchable between icons, thumbnails, or detail view. Basically a functional (not pixel for pixel) emulation of Windows File Explorer, but within the Java app. How to do this using only built-in Java libraries? Or a very lightweight framework?
NOT A DUPLICATE
My question is different from the above and I now realize it's a little harder to explain than I initially expected. Two clarifications:
My question is not about a File Chooser. I'm asking about a File Explorer type of dialog. The difference is that a File Chooser is really focused on one task, choosing a file. A File Explorer is a little less focused, and lets the user browse around without a clear objective.
My question is not about native operating system UI / L&F emulation. At all. I'm asking about the basic capability to display the contents of the filesystem using icons and thumbnails. The style and borders etc are not part of my question.
EDIT
I'm looking for something like this
Notice how it's different from this (JFileChooser)
JFileChooser will do that if you are wanting something built in to Java.
https://docs.oracle.com/javase/7/docs/api/javax/swing/JFileChooser.html
If you are not using Swing but SWT (like Eclipse) you can use SWT FileDialog
You could use the AWT library to customly render the entirety of Explorer. Whilst the only hard part about this is correctly using layout managers to get components exactly where you want them and adding event listeners for each button, using AWT wouldn't make it look like Explorer on different operating systems because AWT uses the native system components.
You could check if the OS is not Windows and then use Swing if it isn't. In that case, you'd have to retexture every single used component such that its look and feel is the same as your targeted Windows version. Even if you did that, you'd still have to somehow change the JFrame's look and feel, which is possible using dark magic, but quite obscur. You can do this in a very quirky way, just setUndecorated(true) and manipulate the JFrame's boundaries until it lets you draw outside the JFrame, so that you can draw the Windows' decoration around it without resizing the Window. On top of that, you'd also have to check if it's maximised, as maximized windows don't quite look the same in Windows.
To cut things short, just use JFileChooser if you just want to allow the user to select one or multiple files. There isn't really any point in recreating Explorer, but if that's what you want to do, I'm not stopping you.
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.
I've seen other answers and hacks around to this question, but none seem to do exactly what I'm after.
Essentially, I'm after a JWindow whose background is translucent but the content of the window itself (buttons, text and so on) are opaque. The methods I've seen so far fall into one of two categories:
Taking screenshots from behind the window and using them (http://onjava.com/pub/a/onjava/excerpt/swinghks_hack41/index.html) - this isn't much good in this scenario since it's too slow, I want to be able to put things like video behind the window and have it show through
Making the whole window translucent (including the components on it which I need to remain opaque.)
Is what I'm asking for possible, and if so how would it be done? If not, will Java 7 provide any methods that would make this easier / possible? I know it's got more support built in for shaped windows so I wonder whether something there could take care of this also. I've been searching around for a while now but with no luck.
Can only be done if you are using JDK 6 update 10 and above. Must also support hardware acceleration. See
http://download.oracle.com/javase/tutorial/uiswing/misc/trans_shaped_windows.html
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.