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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T11:41:08+00:00 2026-05-26T11:41:08+00:00

I’m have no trouble when creating menu bar and its item. But now, when

  • 0

I’m have no trouble when creating menu bar and its item. But now, when I get a question how to make the menu items appeared as column & rows-like table shaped, I really don’t know about that.

The goals is to create this kind of menu items using java.
Check this link.

And right now, I just think that I should use a jpanel as menu item, and then applying a flowlayout and then adding many jlabel(s) as I could as menuitem inside the grid. But wouldn’t it worst?
What’s the best deal to create the menu items such as the image preview on the above links?

I tried google, but found no related cases. CMIIW.

  • 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-26T11:41:08+00:00Added an answer on May 26, 2026 at 11:41 am

    The popup menu of a JMenu instance is a standard container, so you can add to it whatever you want. It has a default layout, but you can change it.

    Something like in your mockup is created by this code:

    import javax.swing.*;
    import java.awt.*;
    
    public class Test {
        public static void main(String[] args) {
            EventQueue.invokeLater(new Runnable() {
                @Override
                public void run() {
                    JFrame frame = new JFrame("Menu test");
                    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                    frame.setSize(new Dimension(600, 400));
                    JMenuBar menuBar = new JMenuBar();
                    JMenu menu = new JMenu("Test");
                    JPopupMenu popupMenu = menu.getPopupMenu();
                    popupMenu.setLayout(new GridLayout(5, 5));
                    for (int r = 0; r < 5; r++) {
                        for (int c = 0; c < 5; c++) {
                            popupMenu.add(new JMenuItem("(" + (r + 1) + ", " + (c + 1) + ")"));
                        }
                    }
    
                    menuBar.add(menu);
                    frame.setJMenuBar(menuBar);
    
                    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 jquery bug and I've been looking for hours now, I can't
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
this is what i have right now Drawing an RSS feed into the php,
I have a French site that I want to parse, but am running into
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but
I have this code to decode numeric html entities to the UTF8 equivalent character.
Seemingly simple, but I cannot find anything relevant on the web. What is the
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this

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.