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

VM hangs at moving focus out of a text component while composing

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P2
    • Resolution: Fixed
    • Affects Version/s: 1.3.0, 1.3.1_01
    • Fix Version/s: 1.3.1_03
    • Component/s: client-libs
    • Labels:
    • Subcomponent:
    • Resolved In Build:
      03
    • CPU:
      x86
    • OS:
      linux, solaris_2.5.1

      Backports

        Description



        Name: dc32491 Date: 03/28/2001


        When a text component loses focus while composing, VM hangs.
        Run the following code, click one of the two text components, invoke Input Method, type ji, which will be composed to a Japanese kana, click the other component. VM hangs.
        Note calling to endComposition in focuse listener does not help.
        Test environment:
        OS: Redhat Linux 6.2J
        IME: Canna w/ Input2

        import java.awt.*;
        import javax.swing.*;
        import java.awt.event.*;

        /**
         * Title: Test case for Composition hanging
         */

        public class Frame1 extends JFrame {
          JTextArea jTextArea1 = new JTextArea();
          JEditorPane jEditorPane1 = new JEditorPane();

          public Frame1() {
            try {
              jbInit();
            }
            catch(Exception e) {
              e.printStackTrace();
            }
          }
          public static void main(String[] args) {
            Frame1 frame1 = new Frame1();
            frame1.pack();
            frame1.setSize(300,200);
            frame1.setVisible(true);
          }
          private void jbInit() throws Exception {
            jTextArea1.setText("jTextArea1");
            jEditorPane1.setText("jEditorPane1");
            jEditorPane1.addFocusListener(new java.awt.event.FocusAdapter() {
              public void focusLost(FocusEvent e) {
                jEditorPane1_focusLost(e);
              }
            });
            this.getContentPane().add(jTextArea1, BorderLayout.NORTH);
            this.getContentPane().add(jEditorPane1, BorderLayout.CENTER);
          }

          void jEditorPane1_focusLost(FocusEvent e) {

            java.awt.im.InputContext context = null ;
            for (Container parent = getParent(); parent != null; parent = parent.getParent()) {
              if (parent instanceof Window) {
                context = ((Window)parent).getInputContext();
                break;
              }
            }
            if (context != null) {
              context.endComposition();
            }
          }
        }
        (Review ID: 119536)
        ======================================================================

          Attachments

            Issue Links

              Activity

                People

                Assignee:
                naoto Naoto Sato
                Reporter:
                duke J. Duke (Inactive)
                Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                  Dates

                  Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: