-
Bug
-
Resolution: Fixed
-
P4
-
1.2.1, 1.2.2
-
beta
-
generic, x86, sparc
-
generic, solaris_2.6, windows_98, windows_nt
Name: vi73552 Date: 04/29/99
JComboBox has a few items (strings)
and registered ChangeListener and ActionListener,
inside which print statement is coded .
Now when this combo box is shown for the first time, it has the
first item selected. Click on the combo to get popup with choices
The first item is highlighted - correct.
Move your mouse over first item, hold CONTROL key and click the item -
it becomes unselected - the selection in combobox is empty - correct.
What is incorrect is that no ItemEvent with "USELECTED" state change
nor ActionEvent was generated. Now select an item and try to repeat
the scenario unselecting it using CNTRL + mouseClick.
Both ItemEvent and ActionEvent are generated - but
what happened to the initial ones?????
import javax.swing.*;
import java.awt.event.*;
import javax.swing.border.*;
import java.awt.*;
public class a
{
public static void main(String args[])
{
JComboBox combo = new JComboBox(new String [] {"task 1","task 2", "task3","task 4","task "});
combo.addActionListener(
new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
System.out.println("Action event");
}
});
combo.addItemListener(
new ItemListener()
{
public void itemStateChanged(ItemEvent e)
{
System.out.println("Item state changed");
}
});
JFrame f = new JFrame();
f.getContentPane().add(combo);
f.pack();
f.setVisible(true);
}
}
(Review ID: 57636)
======================================================================
- duplicates
-
JDK-4248690 Selecting from a combo box while pressing CTRL results in an invalid selection
-
- Closed
-
-
JDK-4298197 JComboBox fires extra action event on deselection
-
- Closed
-
- relates to
-
JDK-6355525 Selecting from a combo box while pressing CTRL results in an invalid selection
-
- Closed
-