[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now


JComboBox changed event

Posted on 2004-10-29
Medium Priority
Last Modified: 2011-09-20
I thought that the ActionPerformed() would fire an event if I changed the selection in a combo box, however fires even when the component is loaded.  What event do I use to fire only when  user makes a selection?

Question by:lomidien
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
LVL 37

Expert Comment

ID: 12443447
You should use actionPerformed()
LVL 37

Expert Comment

ID: 12443450
>> however fires even when the component is loaded
I use a flag to skip the changes when loading
LVL 37

Accepted Solution

zzynx earned 2000 total points
ID: 12443467
boolean skipChanges = false;

skipChanges = true;
// fill up the combobox and make initial selections
skipChanges = false;

public void actionPerformed(ActionEvent evt) {
   if (skipChanges) return;

   // do what you want
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.


Author Comment

ID: 12443479
Perfect, thanks a bunch.

LVL 37

Expert Comment

ID: 12443502
>> however fires even when the component is loaded.
Rather logical after a second thought, since loading the component = selecting the first item in it
LVL 37

Expert Comment

ID: 12443514
You're welcome
Thanks for accepting :°)

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.
Suggested Courses

650 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question