classpath-patches
[Top][All Lists]
Advanced

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

[cp-patches] FYI: DefaultEditorKit fix


From: Roman Kennke
Subject: [cp-patches] FYI: DefaultEditorKit fix
Date: Wed, 08 Jun 2005 12:02:31 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.2.1) Gecko/20021204

Hi,

I fix (part of) the implementation of DefaultEditorKit. The DefaultKeyTypedAction should filter control characters and leave handling of them to the other Action classes here.

2005-06-08  Roman Kennke  <address@hidden>

   * javax/swing/text/DefaultEditorKit.java
   (DefaultKeyTypedAction.actionPerformed): This action
   has to filter control characters here.
   (InsertBreakAction.actionPerformed): This action inserts
   a newline character here.

/Roman

Index: javax/swing/text/DefaultEditorKit.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/swing/text/DefaultEditorKit.java,v
retrieving revision 1.14
diff -u -r1.14 DefaultEditorKit.java
--- javax/swing/text/DefaultEditorKit.java      8 Apr 2005 08:04:33 -0000       
1.14
+++ javax/swing/text/DefaultEditorKit.java      8 Jun 2005 09:56:19 -0000
@@ -102,6 +102,13 @@

     public void actionPerformed(ActionEvent event)
     {
+      // first we filter the following events:
+      // - control characters
+      // - key events with the ALT modifier (FIXME: filter that too!)
+      char c = event.getActionCommand().charAt(0);
+      if (Character.isISOControl(c))
+        return;
+
       JTextComponent t = getTextComponent(event);
       if (t != null)
         {
@@ -129,6 +136,8 @@

     public void actionPerformed(ActionEvent event)
     {
+      JTextComponent t = getTextComponent(event);
+      t.replaceSelection("\n");
     }
   }


reply via email to

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