SingleFrameApplication that does NOT require ALT to activate menuitem mnemonics? - java

In the NetBeans 6.9 IDE, if you create a
New Project >> Java >> Java Desktop Application and run it, you will find that the menu items have mnemonics, but only after ALT is pressed.
(The netbeans program itself uses this style of menu.)
However, if you create a new File >> Swing GUI Forms >> JFrame Form, and add a simple menubar with mnemonics, then run the JFrame, the mnemonics will always appear without having to press ALT. This is what I would prefer.
(Firefox uses this style of menu)
My thoughts are that the org.jdesktop.application overrides the default setting, but that's just a guess. Anyone know how to make a SingleFrameApplication not require ALT to be pressed?
Thanks.
Edit:
The problem was found to be that JFrame and JDesktop use different default Look and Feels

It's a Windows setting. In XP go to:
Control Panel
Display
Appearance
Effects
Hide underlined letters for keyboard navigation until I press the Alt key
(Win7 should have a similar setting somewhere, I suppose.)
The default setting is on, so Java is right and Firefox is wrong (even Office 2003 doesn't respect that setting).
Uncheck it and you'll always see mnemonic underline in Java.
Note that only Windows LAF correctly respects the setting. Motif and Metal always show the underline. I don't use NetBeans or jDesktop but I guess it uses system LAF and thus the underline is correct.
If you still want to always show underline under Windows LAF (please think twice before you do), call UIManager.getLookAndFeelDefaults().put("Button.showMnemonics", false), which does NOT seem to work for XP because WindowsMenuItemUI#paintText only checks the flag under Vista. You could check Win7 JDK yourself.
Note that there's an accepted bug when the setting is on, which goes like this (saving you some time to parse the 2nd most awful bug tracking system in the universe. The worst is an in-house ColdFusion system my company used to have): create one menu with mnemonic, for example &File, press Alt-F, release, press Alt-F again, the underline is gone. They are back as soon as you do anything else, clicking, or just press Alt by itself.

Related

How to capture the single-click or double-click on window title in JavaFX?

As we all know, when a user double-clicks on a window title bar, that window gets resized to the full available screen size. At least I have seen this happening in Mac OS. Any idea how to capture this event? What should I listen to in my code so that I know that the user has single or double-clicked the Window title?
Don’t try to intercept interactions with Window decorations directly
Don’t try to work with clicks. Handling state changes due to keyboard or window decoration interactions differs between OSes and isn’t a JavaFX function anyway.
Use Stage properties and API instead
Stage has a maximized property (and iconifed), listen for changes on relevant properties. Similarly, there is a full screen mode which is a bit different (see Stage Java doc).
Creating your own window decorations
If you really want complete control, you can use an undecorated stage style and add your own decorations in JavaFX for handling basic window system functions. That way, a lot of the decoration functionality can be handled internally by your app, but I really don’t recommend that. There was an old project named Undecorator which assisted doing this if you wanted to go that route (I don’t advise coding it yourself).
Capturing clicks is a bad idea as #jewelsea mentioned in his comment. The effort in the question was to know why the behavior. Upon research, I found that it is a bug already listed by Oracle - please find below: Each window when double-clicked on the title bar is expected to assume full-screen height and width (Maximised) and on double-clicking title bar again should get back to its previous size. This is not working beyond JDK8 is what I understood from this link. However, on macOS Monterey 12.1 (OpenJDK 17) the window is assuming maximized size on double-clicking the title bar, but, is unable to go back to the previous size when double-clicking again.
https://bugs.java.com/bugdatabase/view_bug.do?bug_id=JDK-8232812

SceneBuilder submenus unusable

Not sure if this is the correct place to ask. If there's a better SE site for that please let me know.
Ever since I've started using SceneBuilder it's sub-menus are completely unusable, as they disappear as soon as I move the cursor to select an option.
For example - say I want to change the font size for a label. I click on the "Font" property, which opens the family, size and style properties. Now I click on the size, which opens a drop-down list of sizes, but as soon as I move the cursor to a value the drop-down list disappears! It's as if SceneBuilder thinks I've given up on selecting a value, so it should hide the drop-down again.
The exact same thing happens, for example, when trying to change properties of effects, and anywhere there is a drop-down not in the main window.
I am using the latest (8.0.0) SceneBuilder from Gluon, although the exact same thing happened on Oracle's 2.0 (which is older and not maintained, as far as I could tell). I'm on Linux Debian 64bit, Java version 1.8.0_u40.
Any hint as to why this is happening, and how to solve it?
Normally SceneBuilder does not show such a behavior. I can only imagine that this behavior is triggered by some Linux Java bug. My suggestion would be to switch to Windows or Mac (probably not an option for you :-)) or at least use a more recent version of Java in the hope that this bug has been fixed in the meantime.

Disable showing of run window in IntelliJ

In IntelliJ every time I make a change in code and I run the app afterwards, "run window" is automatically popped up. Is there any way to disable this annoying behaviour or how to make it less distracting?
I finally could solve this one. At least it worked for me. At the bottom of "Run/Debug configurations" window and in "Before launch" part, uncheck "Activate tool window" check box.
There is currently no solution to do this permanently. However, there is a workaround to prevent it from popping up. Try this:
After the first time the window pops-up simply resize it all the way to the bottom (i.e. grab the TOP and drag down until the window disappears). This will prevent it from popping up again until you manually click one of the buttons to open any window in the same area (i.e. Run, TODO, Android, Terminal, Messages, (and Find Results) - or whatever you have in that same area if you've customized it).
To keep it from popping up, never click the hide button on any of these windows but rather use the same "drag from top to bottom" to hide them (the effect is the same).
This is annoying, to say the least, but once you get used to it it works fine and is much less annoying than dealing with that blasted Run popup window :)
NOTE
I should mention that this is completely safe to do as the windows are only hidden when you do this, and clicking the window's button at the bottom will show it in its original size - so nothing goes missing or breaks using this method :-)
These are called Tool Windows. Right-click the tool window, it pops up a menu, the last option of which is 'Hide'.
Alternatively,
You can install the plugin ToolWindow Manager to show/hide the Tool Window of your choice.
Either
1. Set the run window to be in either split and then shrink it down to be as small as possible.
2. Set the windows to be in floating mode and then shrink it down and move it somewhere less distracting.
disabling checkboxes in "Window | Background tasks solved my problem.
It is soooo annoying oO I just dragged the windows to an other screen and/or set their height to a minimum.. Not "best practise" but it is better than nothing -.-
In intellij go to main menu windows->active tool window->disable floating mode option there.
thanks
For those who are facing this issue with "Run" window they can follow below instruction
From dropdown select "Edit Configuration":
Open Logs tab:
Uncheck these 2 checkboxes:
I have found a solution!!!!
There old plugin for Intellij IDE called "Hide Tool Window Ex".
It hides any tool windows that being opened just after you click in editor again.
(plugin page)
visual example

Blank but still somewhat working user interface

I've written a Java database program using Swing, and it looks and works fine on my Windows machine. I was expecting to be able to transfer it to my Linux (CentOS 6) machine with no problems, and while it compiles and runs just fine, the GUI is blank.
Specifically, a JDialog that I show appears as a solid grey rectangle, but I can still see my cursor change to an I bar when I hover over the text boxes, and I can type into them and press the invisible Ok button, and it works. (This is a database login dialog.)
Then, a JFrame that I've setup as an MDI parent is displayed, but it has zero size. If I drag it open it does have a border, but it does not visibly have the menu that I placed on it. I don't seem to be able to access the menu invisibly as I was able to on the JDialog.
I suspect that this must have something to do with some Java or library version, but I'm not sure. I tried installing Java 7 but it didn't change anything. I'm not sure if I should uninstall Java completely and try reinstalling it, or if maybe it has something to do with the project instead (I am using Eclipse Kepler if that helps.)
I see a few other "Java program is blank" questions, but they either do not have answers or are not the same issue I am having. (My program is only blank under CentOS so far; it works and looks just fine under Windows.)
I narrowed it down to a single line. In the JDialog I had the following:
setType(Type.POPUP);
as soon as I removed this line, the dialog became visible.
Additionally, I find that if I use the Test/Preview... feature (this is using the WindowBuilder) when that line is present, it shows the dialog blank, but it is non-interactive and effectively hangs Eclipse. This led me to "end-task" java.exe, which did unfreeze Eclipse, but it ended up causing even more problems, including the ones I was having with my MDI JFrame.
After rebooting, and removing the above POPUP line, everything is working great.

Background of Eclipse's method list description panel is black

I'm running Ubuntu 11.04 on my system and am using OpenJDK. When I installed the Java Eclipse IDE, everything seemed to work fine at first until I started a project. When the method/variable list appears, it looks fine except that the panel giving you information on the method has a black background with white text. I want to change that back to black text on white, but my search through the preferences turned up nothing.
That is a setting that you have to change in Gnome. I don't have Ubuntu installed currently, so the solution is from my memory, and maybe the menu entries are named a bit differently:
Go to System Settings -> Appearance. Then you have somewhere a button to change colors, and there is somewhere an entry for tooltips, which is black. Change that and the color setting for the font.

Categories