Results 1 to 2 of 2
  1. #1
    leonard is offline Member
    Join Date
    Jul 2007
    Posts
    43
    Rep Power
    0

    Default how to add a KeyListener

    I want to display texts through a panel inside a frame.

    how can I add a KeyListener? Do i have to add this in the frame or in the panel??

    Please help me

    thanks

  2. #2
    gabriel is offline Member
    Join Date
    Jul 2007
    Posts
    41
    Rep Power
    0

    Default

    Java Code:
    txtBox.addKeyListener(new ActionListener(){
    public void actionPerformed(ActionEvent e) {
    Type();/* this will go to your function Type() */
    }
    });
    
    Public void Type() {
    txtBox.getText();
    /*not exactly sure what you want but this is just a quick example of what you can do */
    }

Similar Threads

  1. keyListener isn't working for me
    By lost_in_java in forum AWT / Swing
    Replies: 7
    Last Post: 12-05-2008, 05:24 AM
  2. Help with KeyListener in applet
    By mathias in forum Java Applets
    Replies: 1
    Last Post: 08-06-2007, 03:22 AM

Posting Permissions

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