Is it possible to listen for a mouse click on the icon shown in the taskbar (not System Tray)? My problem is that I am using an undecorated window for my GUI, and that causes me to lose the ability to minimize the application by clicking on the taskbar icon. Currently I minimize the application via a button I have added to the scene. Thanks for the help.
Related
I am very new to JavaFX. As I am a swing developer, I am facing some problems with JavaFX. In swing I create a main window with JFrame. On the top I add a Menubar. When a menu item is clicked, a JInternalFrame is opened below the Menubar in a JDesktopPane. I've found this way very useful, because I can open any JInternalFrame from menubar as well as from the JInternalFrame itself. The JInternalFrame remains open until user closes them. When user presses escape button he can go back to the previously opened frame.
I've found some libraries that switch scenes. But I cannot find an equivalent way in JavaFX. Can anyone help me to achieve this ?
How do I disable the Common User Access Features in an undecorated Swing window, like when pressing the ALT-Key, some invisible Window-Menu is being focused? That I do not want!
Basically I want to give the ALT-Key by own functionality in my application but pressing ALT causes the invisible TitleBar of the window to be somehow focused. How can I turn that off?
On OSX my Java application has a dock menu (using Apples extension to Java com.apple.eawt.Application.getApplication().setDockMenu) , allowing tasks to be started by right clicking on the dock icon, also files can be dropped onto the dock icon (Using Apples com.apple.eawt.OpenFilesHandler) and my application starts processing the dropped files.
I'm trying to replicate this functionality if sensible on Windows, if this behaviour on Windows is weird I don't want to do it. I cannot find a way to add tasks to to the popup menu for the application icon on the taskbar (my application is has an .exe wrapper provided by winrun4j), is that possible ?
But I have used java.awt.SystemTray to add a right click menu to that, and it works but I'm unclear in Windows when one would use the taskbar icon and when the SystemTray. What I cannot do is have the SystemTray respond to files being dropped onto it, and according to this Oracle Java issue it will never happen http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=7119272. What I'm unclear about is if the Windows System tray is never meant to respond to things being dropped on it, or if this is just missing functionality in the Java implementation.
And is there way to drag files onto the taskbar icon instead, or is this whole notion of dragging files onto minimized icons purely an OSX thing and not relevent to Windows ?
To answer my own question files cannot be dropped directly onto pinned taskbar icon or the toolbar icon, but if you drag files onto the taskbar icon it should cause the main window to be displayed and then the files can be dropped onto the window instead, and this behaviour happens automtically with no coding required on my part.
I have a non-trivial Java applet. It has a menu, and via that menu applet shows a dialog that extends JDialog. Dialog is shown using setVisible(true). When user finishes working with that dialog, dialog is closed (after pressing "done" button) using this.dispose().
Now, there's a strange problem - applet works fine in Firefox, even in IE but in Chrome, when applet shows some other (dialog) window, that window is shown behind the applet. I have to click on the place where dialog should be in order to show it (bring it to front). If I click it again (while it's shown) it will disappear (go to background) again. Button clicks are working as usual, but whenever I click at popup window itself (even it's title-bar) it changes it's "visible" state.
Please, any idea what's wrong? How to resolve that bug?
// the applet will typically appear inside a Window, get a reference to it using:
Window parent = Window.getWindows()[0];
// use the window as the parent of a modal dialog.
JDialog dialog = new JDialog(parent);
dialog.setModal(true);
// ...
dialog.setVisible(true);
// won't be called until the applet is dismissed
someJComponent.requestFocusInWindow();
Applets embedded in web pages will always be subject to modality and focus problems. For a better user experience, launch the applet free-floating using Java Web Start, or even better still, launch a frame using JWS.
I am building a small GUI application where I use drag and drop internally on custom components. Now I want to have context menus on the components which have drag and drop enabled.
Now my question is, how do I properly distinguish between these two events.
For context menus there is an API function, but for DnD I did not find one.
I used mouse down to trigger DnD, but with that for example on Windows context menus stop working because they are triggered on mouse up.
For DnD use a combination of mouse down and mouse move.
For context menu use the mouse clicked event (so the menu comes up when the mouse button is released not when it's pressed).
The Swing tutorial has sections on "How to Use Menus" and "Drag and Drop".
The section on menus show how to display a popup by checking the "isPopupTrigger" of the MouseEvent. Although since JDK5 this process is easier as the setComponentPopupMenu()method has been added.
The secton on DnD shows how to use the built in DnD support.