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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T15:54:29+00:00 2026-06-15T15:54:29+00:00

So I’m having another issue….. I’m currently using a BorderLayout in my GUI so

  • 0

So I’m having another issue…..

I’m currently using a BorderLayout in my GUI so that when I resize my jframe, all of the internal components resize with it. I couldn’t get any other layout to work with how I want the GUI to look while providing this resizing capability. At the top I have a JMenuBar, and below it I have a bunch of buttons. Below that I am supposed to have a JSplitPane, and it is there. However, the buttons seemed to be contained within the JSplitPane, which is not my intention. So when anything happens within the splitpane, the buttons disappear until I move my mouse over them again.

When I set my layout to null everything works great except I lose the resizing capability, which is not good.

Tried posting images but it wont let me since my rep isnt at 10 yet 🙁

Any suggestions?
I’ve tried putting the buttons into a JPanel then adding the jpanel but the splitpane overlaps with that. Same with a JToolBar.

The order in which I add my items is:

1) the menu bar

setJMenuBar(menuBar)

2) the buttons

getContentPane().add(btnZoomIn)

etc.

3) the split pane

getContentPane().add(splitPane)

then the rest of the things you see after that

  • 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-15T15:54:30+00:00Added an answer on June 15, 2026 at 3:54 pm

    Seems to work fine for me…

    enter image description here

    public class BadLayout06 {
    
        public static void main(String[] args) {
            new BadLayout06();
        }
    
        public BadLayout06() {
            EventQueue.invokeLater(new Runnable() {
                @Override
                public void run() {
                    try {
                        UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
                    } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) {
                    }
    
                    JMenuBar mb = new JMenuBar();
                    mb.add(new JMenu("File"));
    
                    JToolBar tb = new JToolBar();
                    tb.add(new JButton("Zoom In"));
                    tb.add(new JButton("Zoom Out"));
                    tb.add(new JButton("Invert Image"));
                    tb.add(new JButton("Toggle Highlights"));
                    tb.add(new JButton("Save"));
                    tb.add(new JButton("Cancel"));
                    tb.setFloatable(false);
    
                    JSplitPane spSub = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
                    JTabbedPane tpLeft = new JTabbedPane();
                    tpLeft.add("Table Entry", new JPanel());
                    tpLeft.add("Form Entry", new JPanel());
                    spSub.setLeftComponent(tpLeft);
                    JTabbedPane tpRight = new JTabbedPane();
                    tpRight.add("Field Help", new JPanel());
                    tpRight.add("Image Navigation", new JPanel());
                    spSub.setRightComponent(tpRight);
    
    
                    JSplitPane spMain = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
                    spMain.setLeftComponent(new JPanel());
                    spMain.setRightComponent(spSub);
    
    
                    JFrame frame = new JFrame("Testing");
                    frame.setJMenuBar(mb);
                    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                    frame.setLayout(new BorderLayout());
                    frame.add(tb, BorderLayout.NORTH);
                    frame.add(spMain, BorderLayout.CENTER);
                    frame.pack();
                    frame.setLocationRelativeTo(null);
                    frame.setVisible(true);
                }
            });
        }
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
That's pretty much it. I'm using Nokogiri to scrape a web page what has
We're building an app, our first using Rails 3, and we're having to build
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
Let's say I'm outputting a post title and in our database, it's Hello Y’all
I am reading a book about Javascript and jQuery and using one of the
I've got a string that has curly quotes in it. I'd like to replace
I have a small JavaScript validation script that validates inputs based on Regex. I
I am currently running into a problem where an element is coming back from

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.