How to disable CUA in Swing - java

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?

Related

How can I get mouse focus on Windows PCs when using modal Swing?

I need to drag windows that do not have keyboard focus on Windows 10 computers. Swing functions on my PC deny "mouse focus" on all windows in the same java application; they are locked out of being moved or uncovered for viewing.
The latest Swing dialog window controls the show; any other window that is needed for viewing (to help on answering the dialog) is unavailable when it is covered by another application window. On the Mac/OS X, mouse focus is not a problem; all windows seem to have it.
Is there a way to get this "mouse focus" on the PC when using the convenient modal Swing functions?
The 3 windows at issue in my application are:
Dialog: The latest Swing dialog hording all the mouse focus
Blocker: A JFrame or JDialog window that may or may not be an ancestor of Dialog but it is a big enough window to block view of Blockee
Blockee: The one that has information needed to answer the Dialog.
Only Dialog can be dragged on Windows 10 in this situation.
Is moving the information needed into the Dialog the only answer?
Are there windows 10 settings that can make it perform more sensibly?
I tried using different threads for Blockee and Blocker to no avail.
I found a fairly easy workaround for many cases: Identify the Blocker window and then take away its focusability (perhaps temporarily) when it might be a blocker and is no longer needed.
java.awt.Frame blocker = this; // or <parent> <grandparent>, etc.
blocker.setFocusable(false);
This does not make the Blocker or Blockee window moveable but it eliminates the problem by preventing the blocking. Maybe some day there will be a better solution for this in Windows 10.

JavaFX Multiple screens with Menubar on top

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 ?

Is there simple way to detect keyboard and mouse button being pressed and held in Java without application focus?

I'm trying to write quite simple program in Java - when user click left mouse button it will autoclick until released, but only if toggled before with keyboard key. I have no problem with this autofire part, but I dont know how to detect keyboard press, and mouse button press when my aplication doesn't have focus. Is there some simply way to do it?
On a side note - Are you creating macro for game?
You can download jNativeHook https://code.google.com/p/jnativehook/ and hook global listener to globalScreen that way it doesn't matter if you have focus over application.
Then you can use it like normal swing/fx listener.
CAUTION
Make sure that you unhook it correctly otherwise after some hooks it might be blocked and you will have to restart the PC to hook it again (fixed in future release).
If you are doing a macro for a game you might have a problem when focused on window - some fullscreen games and even in windowed mode, at least from my personal experience. Robot will also fail in some games to execute event.

Java EventHandler on Taskbar Icon

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.

handling drag and drop and context menu events cross-platform in java

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.

Categories

Resources