你试试这个!jlFunctions.addListSelectionListener(new ListSelectionListener(){
     public void valueChanged(ListSelectionEvent e){
         if (e.isTemporary()) return;
  /**---------Handle the  jsFunction ListSelectionEvent */
         System.out.println("the JComboBox event");
     }
 });

解决方案 »

  1.   

    哦!不对,我记错了!呵呵!这是FocusEvent的方法!
    up
      

  2.   

    most likly you call the method twice under two listeners
      

  3.   

    根据sun的教程上说,itemListener和listSelectionListener在你选择不同的内容时都会发生两次,最好用addActionListener:
    petList.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            JComboBox cb = (JComboBox)e.getSource();
            String petName = (String)cb.getSelectedItem();
            picture.setIcon(new ImageIcon("images/" +
                                          petName + ".gif"));
        }
    });sun的教程:
    Combo boxes also generate item events, which are fired when any of the items' selection state changes. Only one item at a time can be selected in a combo box, so when the user makes a new selection the previously selected item becomes unselected. Thus two item events are fired each time the user selects a different item from the menu. If the user chooses the same item, no item events are fired. Use addItemListener to register an item listener on a combo box. How to Write an Item Listener gives general information about implementing item listeners.
      

  4.   

    原因是这样的:
    JComboBox在选择其中的一项时先发生的是释放它先前选则的那一项,
    然后发生的是选择现在选择的那项不过JComboBox好象没有addListSelectionListener方法耶!!!
    应该是这样的吧!你这样试试就明白我上面说的了.
    JComboBox c=new JComboBox();
    c.addItemListener(new ItemListener(){
      public void itemStatechanged(ItemEvent event){
        int state=event.getStateChange();
        String item=(String)event.getItem(),s;
        if(event.getStateChange()==ItemEvent.SELECTED)    s="123";
        if(event.getStateChange()==ItemEvent.DISELECTED)  s="456";
        System.out.println("the state is:"+s);
    }
    });看看结果你就明白了.
      

  5.   

    JList好象没有,你自己再好好看看把!JComboBox有的原因是它加的事件是ItemEvent,而ItemEvent有这两个属性.