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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T16:15:30+00:00 2026-05-15T16:15:30+00:00

I want to display some information in a JMenuItem. The data format is like

  • 0

I want to display some information in a JMenuItem. The data format is like this:

1-1|Menu Name1

1-2|Menu Name2

My problem is that when I create the JMenuItem it displays the whole key-value pair. I’m wondering if there is a similar behavior in Swing like the HTML’s

<SELECT>
 <OPTION value="1-1">Menu Name1</OPTION>
 <OPTION value="1-2">Menu Name2</OPTION>
</SELECT>

…where the user never sees the key, only sees the values.

I’m not familiar with Swing so if anyone knows a similar behavior like HTML’s using JMenuItems style please share.

thanks in advance.

  • 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-15T16:15:30+00:00Added an answer on May 15, 2026 at 4:15 pm

    If I understand correctly, you need to set a different accessible property for a JMenuItem so that when the user clicks on the menu item, you have a corresponding value to read that can be used for some other purposes.

    For this, try setActionCommand API; This way you can associate any string with a Menu Item, and in event processing code, you can do a getActionCommand on the source object that generated the event.

    Note: you have 0% acceptance rate. That means you do not accept any answers for the question you posted. Don’t expect too many people to answer your questions.

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

Sidebar

Related Questions

I have a JTable that I want to use to display some data (a
I have this debug tool that used Jquery UIs dialog to display some information.
I want to display results instantly while user enters some information (like google search).
In my app,I want to display some information in the middle of the screen
I want to display and edit some objects in a WPF data grid and
I'm writing an AJAX function that returns some information to display in a <div>
I want to submit some information that isn't a column on a model, so
I'm using this jquery to display some information on hover: jQuery(document).ready(function() { jQuery('.promo_slider_wrapper').hover(function() {
I want to sent some information through a from, executing a php file that
I want to display some information and some images when a google marker is

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.