Capturing an event when a Textfield changes.

From: Bilal Sallakh (afkar_at_mail2world.com)
Date: 10/28/04

  • Next message: Gemmel: "JPanel in Scrollpane"
    Date: 28 Oct 2004 11:31:36 -0700
    
    

    In this code fragment:

    public class FrameLayers extends JFrame {

      JTextField txtWidth = new JTextField();

      public FrameLayers() {
        txtWidth.addInputMethodListener(new InputMethodListener() {
          public void caretPositionChanged(InputMethodEvent event) {
          }
          public void inputMethodTextChanged(InputMethodEvent event) {
            System.out.Println("Hallo Welt");
          }
        }
      }
    }

    I want to do something (here printling a string) when the user type
    something in the JTextField.

    The code doesn't work..

    Why?

    In the docs I read that getInputMethodRequests should be used
    somewhere... How?

    Thanks in advance...


  • Next message: Gemmel: "JPanel in Scrollpane"