I reinforced the strange behavior of handling Swing mouse position while maximizing the JFrame:
When I execute this very simple code ...
public class Test { public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { JFrame frame = new JFrame(); JMenuBar menubar = new JMenuBar(); JMenu menu = new JMenu("File"); menu.add(new JMenuItem("New")); menubar.add(menu); frame.setJMenuBar(menubar); frame.setSize(200, 200); frame.setLocationRelativeTo(null); frame.setVisible(true); } }); } }
... Usually I can click File
(first click - click, release) β New
(second click). But when I maximize the JFrame and click on File
, the context menu immediately disappears on the mouse output. Moreover, when I hold the mouse button - to prevent fading, I have to move the mouse more to focus on the New
element.
The red dot represents the area (more or less) where I have to move the mouse to focus on New
after clicking File
and holding the mouse.
I observed the same behavior when using the "context menu" context menu, for example, when right-clicking on a chart from JFreeChart.
I thought this was a JDK problem because I used Oracle JDK, but after installing OpenJDK, I have the same results.
Has anyone observed this strange behavior? Or am I missing something obvious?
I use:
- 1.7.0_147-icedtea (or 1.7.0_04 for java-7-oracle)
- OpenJDK workspace (IcedTea7 2.0) (7 ~ b147-2.0-0ubuntu0.11.10.1)
- 64-bit OpenJDK virtual machine (build 21.0-b17, mixed mode)
- Linux Mint 12 (lisa) GNOME 3.2.1
Xeon source share