Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4293314

The behavior of JEditorPane.processComponentKeyEvent() was changed.

XMLWordPrintable



      Name: aaC67449 Date: 11/22/99


      The behavior of JEditorPane.processComponentKeyEvent() method was changed in
      JDK1.3.0. The method does not consume TAB events now. See example.
      It is incompatible change, the old behavior should be restored.

      the javadoc 1.2.2 says: "
      protected void processComponentKeyEvent(KeyEvent e)

            Make sure that TAB and Shift-TAB events get consumed, so that awt doesn't
            attempt focus traversal.
            Overrides:
                  processComponentKeyEvent in class JTextComponent
            Tags copied from class: JTextComponent
            Parameters:
                  e - the event
      "

      the javadoc 1.3.0 says: "
      protected void processComponentKeyEvent(KeyEvent e)

            Overriden to handle processing of tab/shift tab. If e
            identifies a tab, the receiver is not editable and has
            components, then the FocusManager is asked to pass
            focus to the next/previous component.
            Overrides:
                  processComponentKeyEvent in class JComponent
      "

      ------------------------- example1 ----------------
      import javax.swing.JEditorPane;
      import java.awt.event.KeyEvent;

      public class Test{

          public static void main(String argv[]) {
         
              StubJEditorPane ja = new StubJEditorPane();
              KeyEvent keTab = new KeyEvent(ja, KeyEvent.KEY_PRESSED, 0, 0,
                      KeyEvent.VK_TAB);
         
              ja.processComponentKeyEvent(keTab);
          
              if (!keTab.isConsumed()) {
                  System.out.println("The event was not consumed");
              } else {
                  System.out.println("OKAY");
              }

         }
      }

      class StubJEditorPane extends JEditorPane {
           public StubJEditorPane() {
              super();
          }

          public void processComponentKeyEvent(KeyEvent e) {
              super.processComponentKeyEvent(e);
          }

       }
      -------------------- JDK1.3.0M -------------------
      The event was not consumed
      ------------------------- JDK1.2.2W ----------------
      OKAY

      ======================================================================

            svioletsunw Scott Violet (Inactive)
            alisunw Ali Ali (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: