commit-classpath
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[commit-cp] [bug #13254] swing: keyTyped sent before newline has been ad


From: Timo Lindfors
Subject: [commit-cp] [bug #13254] swing: keyTyped sent before newline has been added to JTextArea
Date: Wed, 1 Jun 2005 11:35:09 +0000
User-agent: Elinks

URL:
  <http://savannah.gnu.org/bugs/?func=detailitem&item_id=13254>

                 Summary: swing: keyTyped sent before newline has been added
to JTextArea
                 Project: classpath
            Submitted by: lindi
            Submitted on: Wed 06/01/05 at 11:35
                Category: classpath
                Severity: 3 - Normal
                  Status: None
                 Privacy: Public
             Assigned to: None
             Open/Closed: Open
        Platform Version: None

    _______________________________________________________

Details:

Steps to reproduce:
1. Compile and run the attached testcase.
2. Hit enter over the textarea.

Expected results:
1. Programs prints the following to stdout
keyPressed, length now 0
keyTyped, length now 1
keyReleased, length now 1

Actual results:
1. Program prints the following to stdout
keyPressed, length now 0
keyTyped, length now 0
keyReleased, length now 1

Testcase:
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class keyhandler extends JFrame {
        private JTextArea a;
        public static void main(String[] args) {
                (new keyhandler()).show();
        }
        public keyhandler() {
                this.a = new JTextArea(80, 25);
                this.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, length now " +
keyhandler.this.a.getText().length());
                }
                public void keyPressed(KeyEvent e) {
                        System.out.println("keyPressed, length now " +
keyhandler.this.a.getText().length());
                }
                public void keyReleased(KeyEvent e) {
                        System.out.println("keyReleased, length now " +
keyhandler.this.a.getText().length());
                }
        }
}

Note that this bug seems to happen only with newline characters, typing
anything else won't trigger the bug.






    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?func=detailitem&item_id=13254>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/





reply via email to

[Prev in Thread] Current Thread [Next in Thread]