2
* $Id: TextComponentAdaptor.java,v 1.2 2007/11/02 14:26:47 kschaefe Exp $
4
* Copyright 2004 Sun Microsystems, Inc., 4150 Network Circle,
5
* Santa Clara, California 95054, U.S.A. All rights reserved.
7
* This library is free software; you can redistribute it and/or
8
* modify it under the terms of the GNU Lesser General Public
9
* License as published by the Free Software Foundation; either
10
* version 2.1 of the License, or (at your option) any later version.
12
* This library is distributed in the hope that it will be useful,
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15
* Lesser General Public License for more details.
17
* You should have received a copy of the GNU Lesser General Public
18
* License along with this library; if not, write to the Free Software
19
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21
package org.jdesktop.swingx.autocomplete;
23
import java.util.List;
24
import javax.swing.text.JTextComponent;
27
* An implementation of the AbstractAutoCompleteAdaptor that is suitable for a
30
* @author Thomas Bierhance
32
public class TextComponentAdaptor extends AbstractAutoCompleteAdaptor {
34
/** a <tt>List</tt> containing the strings to be used for automatic
37
/** the text component that is used for automatic completion*/
38
JTextComponent textComponent;
39
/** the item that is currently selected */
43
* Creates a new <tt>TextComponentAdaptor</tt> for the given list and text
46
* @param items a <tt>List</tt> that contains the items that are used for
47
* automatic completion
48
* @param textComponent the text component that will be used automatic
51
public TextComponentAdaptor(JTextComponent textComponent, List<?> items) {
53
this.textComponent = textComponent;
56
public Object getSelectedItem() {
60
public int getItemCount() {
64
public Object getItem(int index) {
65
return items.get(index);
68
public void setSelectedItem(Object item) {
72
public JTextComponent getTextComponent() {