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

Programatically appending text to TextArea behaves differently with XAWT

    XMLWordPrintable

Details

    • Cause Known
    • x86
    • linux, solaris_2.5.1

    Description

      OPERATING SYSTEM(S)
      --------------------
      RHEL3
      FULL JDK VERSION(S):
      -------------------
      1.5.0_04-b05
      DESCRIPTION:
      ------------
      Run the following test case:
      import java.awt.*;
      import javax.swing.*;
      import java.awt.event.*;
      public class test implements ActionListener{
      public Frame frame;
      public TextArea ta;
      public test(){
      frame=new Frame();
      frame.setLayout(new FlowLayout());
      ta=new TextArea();
      frame.add(ta);
      frame.show();
      ta.append("123");
      System.out.println(ta.getCaretPosition()+"<---Expected 3");
      ta.append("123");
      System.out.println(ta.getCaretPosition()+"<---Expected 6");

      }
      public static void main(String args[]){
      test t=new test();
      }
      public void actionPerformed(ActionEvent e) {
      }
      }
      With the motif toolkit the values 3 and 6 are given which is consistent with
      the behaviour on Windows.
      With the X toolkit the value 0 is given both times.
      Expanding the frame it appears that appending the text in the XAWT Text area leaves the cursor
      at the start of the text whereas with MAWT the cursor is moved to the end of the text.

      Attachments

        Activity

          People

            dav Andrei Dmitriev (Inactive)
            elarsen Erik Larsen (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Imported:
              Indexed: