org.springframework.richclient.list
Class EditableComboBoxAutoCompletion

java.lang.Object
  extended by java.awt.event.KeyAdapter
      extended by org.springframework.richclient.list.EditableComboBoxAutoCompletion
All Implemented Interfaces:
KeyListener, EventListener

public class EditableComboBoxAutoCompletion
extends KeyAdapter

Provides auto-completion for an editable combobox. Based on public domain postings. Original author unknown. Also copied some code from ComboBoxAutoCompletion to deal with focus loss.

Author:
Larry Streepy

Constructor Summary
EditableComboBoxAutoCompletion(JComboBox comboBox)
          Adds autocompletion support to the given combobox.
 
Method Summary
 void keyReleased(KeyEvent e)
          Handle a key release event.
 
Methods inherited from class java.awt.event.KeyAdapter
keyPressed, keyTyped
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EditableComboBoxAutoCompletion

public EditableComboBoxAutoCompletion(JComboBox comboBox)
Adds autocompletion support to the given combobox.

Parameters:
comboBox - the combobox to augment
Method Detail

keyReleased

public void keyReleased(KeyEvent e)
Handle a key release event. See if what they've type so far matches anything in the selectable items list. If so, then show the popup and select the item. If not, then hide the popup.

Specified by:
keyReleased in interface KeyListener
Overrides:
keyReleased in class KeyAdapter
Parameters:
e - key event


Copyright © 2004-2008 The Spring Framework. All Rights Reserved.