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 6550781
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T12:15:28+00:00 2026-05-25T12:15:28+00:00

The JMenu works correctly when I click my mouse over it. I click my

  • 0

The JMenu works correctly when I click my mouse over it.

before

I click my mouse away and it disappears (normal).
I then double click the only entry in my JTree.

Then when I click my JMenu it looks like this. It appears behind the JTree???
after

When I resize the window it returns to normal. Until the JTree has focus again.

This is what my code looks like, I’m subclassing a jframe and this code is in the constructor

Container cp = getContentPane();

//1. menu
JMenuBar menu = new JMenuBar();
//...

cp.add(menu, BorderLayout.NORTH);

//2. split pane
JSplitPane sp = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
//...
{
    //3a. scrollpane (left)
    ScrollPane treeView = new ScrollPane();
    treeView.setMinimumSize(new Dimension(0,0));
    sp.add(treeView, JSplitPane.LEFT);
    {
        //3ai. treeview
        tree = new ObjectTree();
        treeView.add(tree);
    }

    //3b. scrollpane (right)
    ScrollPane tabView = new ScrollPane();
    tabView.setMinimumSize(new Dimension(0,0));
    sp.add(tabView, JSplitPane.RIGHT);
    {
       //3bi tabview
       ObjectTabPane view = new ObjectTabPane();
       tabView.add(view);
    }
}

cp.add(sp, BorderLayout.CENTER);
this.setSize(700, 500);
  • 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-05-25T12:15:29+00:00Added an answer on May 25, 2026 at 12:15 pm

    You’re mixing Swing and AWT components. Don’t do this, because it leads to the problem you’re facing. Use a JScrollpane rather than a ScrollPane.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a JMenu with a JMenuItem , and when I click on this,
I'm currently creating a right-click context menu by instantiating a new JMenu on right
I Have 1 single java app . ONly Containing 1 JMenu with 48 JMenuItem(s)
I have a JMenu and I added a Actionlistener to to it but the
I was trying to make a JMenu behave like a JButton but I'm having
I'm trying to move the menu structure from a JMenu into a JMenuBar. The
I'm developing a java application and I create a dynamic JMenu by hand (depending
Is there any way to auto-select a jmenu within my jmenubar when the user's
import javax.swing.JFrame; import javax.swing.JMenu; import javax.swing.JMenuBar; import javax.swing.JMenuItem; @SuppressWarnings(serial) public class Main extends JFrame
So I have a JMenu with a few submenus inside. The names of those

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.