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

Drag and Drop of IndicLocale chars throws exception

XMLWordPrintable

      OPERATING SYSTEM(S):
      Windows XP SP1

      FULL JDK VERSION(S):
      java version "1.5.0_06"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05)
      Java HotSpot(TM) Client VM (build 1.5.0_06-b05, mixed mode)

      DESCRIPTION:
      On JTextArea, sometimes preedit string is displayed next line when I use indicim.
      When I try drag and drop string which has preedit string, following exception is
      displayed in console.
      This exception is only happened if I drop this string to the component which
      is in another window.
      If the component is in same window, exception is not happened

      ========================================
      Exception in thread "AWT-EventQueue-0" java.lang.IllegalArgumentException: Zero length iterator passed to TextLayout constructor.
              at java.awt.font.TextLayout.<init>(TextLayout.java:594)
              at com.sun.java.swing.SwingUtilities2.drawString(SwingUtilities2.java:649)
              at javax.swing.text.Utilities.paintComposedText(Utilities.java:861)
              at javax.swing.text.GlyphView.paint(GlyphView.java:386)
              at javax.swing.text.BoxView.paintChild(BoxView.java:144)
              at javax.swing.text.BoxView.paint(BoxView.java:407)
              at javax.swing.text.BoxView.paintChild(BoxView.java:144)
              at javax.swing.text.BoxView.paint(BoxView.java:407)
              at javax.swing.text.ParagraphView.paint(ParagraphView.java:582)
              at javax.swing.text.BoxView.paintChild(BoxView.java:144)
              at javax.swing.text.BoxView.paint(BoxView.java:407)
              at javax.swing.text.BoxView.paintChild(BoxView.java:144)
              at javax.swing.text.BoxView.paint(BoxView.java:407)
              at javax.swing.plaf.basic.BasicTextUI$RootView.paint(BasicTextUI.java:1338)
              at javax.swing.plaf.basic.BasicTextUI.paintSafely(BasicTextUI.java:643)
              at javax.swing.plaf.basic.BasicTextUI.paint(BasicTextUI.java:781)
              at javax.swing.plaf.basic.BasicTextUI.update(BasicTextUI.java:760)
              at javax.swing.JComponent.paintComponent(JComponent.java:742)
              at javax.swing.JComponent.paint(JComponent.java:1005)
              at javax.swing.JComponent.paintWithOffscreenBuffer(JComponent.java:4963)
              at javax.swing.JComponent.paintDoubleBuffered(JComponent.java:4916)
              at javax.swing.JComponent._paintImmediately(JComponent.java:4859)
              at javax.swing.JComponent.paintImmediately(JComponent.java:4666)
              at javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:451)
              at javax.swing.SystemEventQueueUtilities$ComponentWorkRequest.run(SystemEventQueueUtilities.java:114)
              at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
              at java.awt.EventQueue.dispatchEvent(EventQueue.java:461)
              at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
              at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
              at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
              at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
              at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)
      ========================================


      Test instructions is as follows:

      1. Copy jre\lib\im\indicim.jar to jre\lib\ext directory
      2. Compile and run DnDTest.java
      ========================================
      import java.awt.*;
      import javax.swing.*;

      class DnDTest extends JFrame {
        DnDTest() {
          super("DnD Test");
          Container c = getContentPane();
          c.setLayout(new GridLayout(0,1));
          JTextArea ta;
          ta = new JTextArea();
          ta.setDragEnabled(true);
          ta.setBorder(BorderFactory.createLineBorder(Color.black));
          c.add(ta);
          ta = new JTextArea();
          ta.setDragEnabled(true);
          ta.setBorder(BorderFactory.createLineBorder(Color.black));
          c.add(ta);
          setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
          setSize(300, 200);
        }
        public static void main(String[] args) {
          DnDTest f1 = new DnDTest();
          f1.setLocation(0,0);
          f1.setVisible(true);
          DnDTest f2 = new DnDTest();
          f2.setLocation(300,0);
          f2.setVisible(true);
        }
      }
      ========================================

      3. Click one of DnD Test window and switch IM to Devanagari Input Method
         On Window menu for window frame, select "Select Input Method" -> "Devanagari Input Method"
      4. Type "af" then preedit string is displayed on next line.
         If preedit string is not displayed on next line, please try the other key combinations.
      5. Press Shift+LeftArrow key twice to select string
      6. Move mouse pointer on this string.
      7. Drag it and drop it to the other DnD Test window.
         At this time, exception is displayed
      8. If you drop this string into another JTextArea on same window, exception is not happened.

            peterz Peter Zhelezniakov
            elarsen Erik Larsen (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Imported:
              Indexed: