Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8024557
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T22:54:02+00:00 2026-06-04T22:54:02+00:00

I encoutered a strange behaviour of handling mouse position by Swing when maximizing JFrame:

  • 0

I encoutered a strange behaviour of handling mouse position by Swing when maximizing 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);
            }
        });
    }
}

… I can normally click File (first click – press,release) -> New (second click). But when I maximize JFrame and click on File – context menu disappears on mouse release immediately.
Moreover when I hold mouse button – to prevent disappearance – I must move my mouse much further to focus on New item.

mouse shift

The red dot represents area (more or less) where I must move my mouse to focus on New after pressing File and holding mouse button.

I’ve observed the same behaviour when using “right-click context menu” for example when right clicking on chart from JFreeChart.

I thought it was JDK problem because I used Oracle’s JDK, but after installing OpenJDK I have the same results.

Did somebody observe this strange behaviour? Or am I missing something obvious?

I use:

  • 1.7.0_147-icedtea (or 1.7.0_04 for java-7-oracle)
  • OpenJDK Runtime Environment (IcedTea7 2.0) (7~b147-2.0-0ubuntu0.11.10.1)
  • OpenJDK 64-Bit Server VM (build 21.0-b17, mixed mode)
  • Linux Mint 12 (lisa) GNOME 3.2.1
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T22:54:03+00:00Added an answer on June 4, 2026 at 10:54 pm

    Yes – this is a bug in JDK7 as @nIcE cOw mentioned.

    I’ve installed JDK6 and I couldn’t reproduce this bug.

    java version "1.6.0_23"
    OpenJDK Runtime Environment (IcedTea6 1.11pre) (6b23~pre11-0ubuntu1.11.10.2)
    OpenJDK 64-Bit Server VM (build 20.0-b11, mixed mode)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've encountered some very strange behaviour when debugging in VS 2010 with a WCF
I recently encountered very strange behaviour with the UIImagePickerController. On our main view we
I have encountered something very strange, simple WPF application <Window x:Class=ListBoxSelection.MainWindow xmlns=http://schemas.microsoft.com/winfx/2006/xaml/presentation xmlns:x=http://schemas.microsoft.com/winfx/2006/xaml Title=MainWindow
Encountered a strange problem with this event, event wrapper and handler: public delegate void
I encountered a very strange (at least to me) behaviour of a exception class
I encountered a very strange behavior when i m trying to insert a NSMutableDictonary
We have encountered a very strange class not found problem in our web app
i am relatively new to php and i've encountered a very strange problem. let
I have encountered a strange behaviour of the model validation in Backbone.js. When a
I just encountered a strange behaviour with the GregorianCalendar class, and I was wondering

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.