CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Nov 1999
    Location
    Indianapolis, IN
    Posts
    191

    JComboBox keyListener


    I want to make a JComboBox editable. Easy enough. Now I want to add a keyListener so I can validate the user's input as he/she keys in text.
    However, the keyTyped event never gets called.

    I'm using the VCE in VA/Java 3.0 with JDK1.2.2. I set up the keyTyped event in the VCE. But the method never gets called.

    Any suggestions as to why this doesn't get called? Or how I can trap the keyTyped event?
    thanks,



  2. #2
    Join Date
    Sep 1999
    Location
    Madurai , TamilNadu , INDIA
    Posts
    1,024

    Re: JComboBox keyListener


    Get editor component and add KeyListener to it.


  3. #3
    Guest

    Re: JComboBox keyListener

    PLease could you (or someone) explain this in better detail...

    "editor" component?

    Thanks + this is a good question..


  4. #4
    Join Date
    Sep 1999
    Location
    Madurai , TamilNadu , INDIA
    Posts
    1,024

    Re: JComboBox keyListener


    Hi ,

    JComboBox has an "Editor"( not a component , javax.swing.plaf.basic.BasicComboBoxEditor )
    which is a wrapper around the actual Editor "Component" ( which is JTextField ). To get this
    JTextField , first you have to get the "Editor" and then get the actual "Component".


    JTextField editorcomp = comboBox.getEditor().getEditorComponent();







Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured