• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 442
  • Last Modified:

Java DateComboBox focus problem

I have a editable DateComboBox and need to validate user-entered data on focusLost.  However, I can't seem to trap the focusLost event.

Never really used this component before....anybody have any tips or outright answers?
m_cmbStartDate.addFocusListener(this);
 
//<snip>
 
    @Override
    public void focusLost(FocusEvent e) {
        System.out.println(e.getSource().toString());
    }

Open in new window

0
bdzot
Asked:
bdzot
  • 3
  • 2
  • 2
1 Solution
 
CEHJCommented:
Please post more code so we can see the full context
0
 
bdzotAuthor Commented:
There's not much more too it...a couple lines of code to put the date retrieved from the database in, and a couple lines of code to save the date to the database.

Oh, and the declaration:  
private com.jidesoft.combobox.DateComboBox m_cmbStartDate;
0
 
CEHJCommented:
Make sure you're adding the right FocusListener
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
bdzotAuthor Commented:
With:

m_cmbStartDate.addFocusListener(this);

won't it trigger the focusLost event in the class it's in?
0
 
objectsCommented:
sounds like you should be adding a PopupMenuListener instead of a FocusListener

0
 
CEHJCommented:
>>won't it trigger the focusLost event in the class it's in?

Yes, but there's a possibility of confusion if there are multiple listeners around
0
 
objectsCommented:
> won't it trigger the focusLost event in the class it's in?

it would (when it loses focus). But it sounds like its not focus lost that you are interested in.

0

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

  • 3
  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now