Mega Code Archive

 
Categories / Java by API / Javax Swing
 

Implements JComboBox KeySelectionManager

import javax.swing.ComboBoxModel; import javax.swing.JComboBox; public class Main {   public static void main(String[] argv) throws Exception {     String[] items = { "A", "A", "B", "B", "C", "C" };     JComboBox cb = new JComboBox(items);     cb.setKeySelectionManager(new MyKeySelectionManager());   } } class MyKeySelectionManager implements JComboBox.KeySelectionManager {   long lastKeyTime = 0;   String pattern = "";   public int selectionForKey(char aKey, ComboBoxModel model) {     return 1;   } }