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

The Archive Base Latest Questions

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

When I register ActionListener on a non-editable JComboBox it fires actionPerformed() every time user

  • 0

When I register ActionListener on a non-editable JComboBox it fires actionPerformed() every time user changes selected item with arrows keys or with context search (typing the first letter of the item name).

I found similar question here:
How to make JComboBox selected item not changed when scrolling through its popuplist using keyboard. But that solution doesn’t cover context search option. It fires actionPerformed() when I type something.

How to determine when user confirms selected item using enter key or mouse click?

  • 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-26T17:34:09+00:00Added an answer on May 26, 2026 at 5:34 pm

    better would be implements ItemListener (fired twice SELECTED and DESELECTED), than ActionListener and KeyBindings, maybe with succes this simple example here

    import java.awt.*;
    import javax.swing.*;
    import javax.swing.event.PopupMenuEvent;
    import javax.swing.event.PopupMenuListener;
    
    public class PopupTest {
    
        public static void main(String[] args) {
            final JComboBox c = new JComboBox();
            c.addPopupMenuListener(new PopupMenuListener() {
    
                @Override
                public void popupMenuCanceled(PopupMenuEvent e) {
                    System.out.println(e.getSource());
                }
    
                @Override
                public void popupMenuWillBecomeInvisible(PopupMenuEvent e) {
                    System.out.println(e.getSource());
                }
    
                @Override
                public void popupMenuWillBecomeVisible(PopupMenuEvent e) {
                    System.out.println(e.getSource());
                }
            });
            JFrame f = new JFrame("Test");
            f.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
            f.getContentPane().setLayout(new FlowLayout());
            f.getContentPane().add(c);
            f.pack();
            f.setVisible(true);
        }
    
        private PopupTest() {
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

public ActionResult Register(RegisterModel model) { if (ModelState.IsValid) { // Attempt to register the user
Is it possible to register a listener to listen for changes in the volume
When users register they associate to one or more locations via user profile. Location
using register_shutdown_function I can register code to execute at the end of a PHP
I register my two interfaces on application start as so:- container.Register(Component.For(typeof(IEntityIndexController)).ImplementedBy(typeof(SnippetController)).LifeStyle.Transient); container.Register(Component.For(typeof(ISnippetController)).ImplementedBy(typeof(SnippetController)).LifeStyle.Transient); Then when
int* Register = 0x00FF0000; // Address of micro-seconds timer while(*Register != 0); Should I
I register the following function //EDIT: updated $("#id").on("change", function() { alert('xxx'); }); In my
containerBuilder .Register<IGraphClient>(context => { var graphClient = new GraphClient(new Uri(http://localhost:9999/db/data)); graphClient.Connect(); // Particularly this
I register a NSNotification in viewDidLoad method. Should I unregister it both in viewDidUnload
def register_page(request): if request.method == 'POST': form = RegistrationForm(request.POST) if form.is_valid(): user = User.objects.creat_user(

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.