How can I get the value typed in a JComboBox where the typed String is NOT an existing JComboBox item?

I tried the following code:

Java Code:
import java.awt.*;
import java.awt.event.*; 
import javax.swing.*; 

public class template {
      JComboBox comboBox;
      JFrame frame; 	
      template() {
         String items[] = {"Item1", "Item2", "Item3"};		
         comboBox = new JComboBox(items);

         frame = new Frame("Template");
         comboBox.addKeyListener(new KeyAdapter() {
             public void keyPressed(KeyEvent keyEvent) {
                 System.out.println("A key was pressed");
                 String comboboxText = (String)comboBox.getSelectedItem();
                 System.out.println("The string " + comboboxText + "was entered.");
        frame.setSize(200, 200);

     public static void main(String args[]) {
          template t = new template();
but I guess I'm asking for the 'selected' value using 'getSelectedItem()' whereas I need to ascertain the String typed by the user in the JComboBox's text field. As a variation, I tried:

Java Code:
String comboboxText = (String)comboBox.getEditor().getItem();

but it didn't work. Any way I can get the text typed in the JComboBox's text field? Thanks a lot.