Bug 22959 - swing: keyEvents not sent to KeyListener of JTextArea
Summary: swing: keyEvents not sent to KeyListener of JTextArea
Status: RESOLVED FIXED
Alias: None
Product: classpath
Classification: Unclassified
Component: classpath (show other bugs)
Version: unspecified
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-05-30 14:41 UTC by from-classpath
Modified: 2005-07-23 22:54 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description from-classpath 2005-05-30 14:41:40 UTC
Steps to reproduce:
1. Compile and run the attached testcase.
2. Type something to the textarea.

Expected results:
1. Strings "KeyTyped" and "KeyPressed" are printed to stdout when
you type something to the textarea.

Actual results:
1. Nothing is printed to stdout.

Testcase:
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class keyhandler extends JFrame {
        public static void main(String[] args) {
                (new keyhandler()).show();
        }
        public keyhandler() {
                JTextArea a = new JTextArea(80, 25);
                a.addKeyListener(new KeyHandler());
                this.setContentPane(a);
                this.setSize(new Dimension(400, 400));
        }
        private class KeyHandler implements KeyListener {
                public void keyTyped(KeyEvent e) { System.out.println("keyTyped"); }
                public void keyPressed(KeyEvent e) {System.out.println("keyPressed"); }
                public void keyReleased(KeyEvent e) { }
        }
}
Comment 1 from-classpath 2005-06-01 09:02:41 UTC
I checked in a fix for that. Please test and close the bug if it works.
Comment 2 from-classpath 2005-06-01 11:15:31 UTC
Nice, seems to work now. (I probably don't have permissions to close the bug since I can't see such an option on this web page even if I am logged in).