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

J2SE_Swing_Reg: the caret disappears when moving to the end of the line.

XMLWordPrintable

    • b65
    • x86
    • windows_xp, windows_vista

        platform: VistaUltimate_64bit
        build:1.7.0.b64
        Case#: closed/javax/swing/text/DefaultCaret/4785160/bug4785160.java

        # Case description:
        Ensure that the horizontal scrollbar is visible in the JTextArea(or reduce the
        with of applet so that the scrollbar becomes visible).Move the text caret in
        the text area to the end of line. Test passed if the caret is visible at the
        end of the line,failed if the caret disappears when moved to the end of the
        line.

        # Actual behavior:
        The caret disappears when moved to the end of the line.
        Attached is the screenshots
        # Exceptions:
        None
        # Steps to reproduce:
        1).do as the following code:
        ---------Begin code---------
        import java.awt.*;
        import java.awt.event.*;
        import javax.swing.*;
        import javax.swing.event.*;
        import javax.swing.text.*;
        import javax.swing.text.html.*;
        ///manual=yesno

        public class bug4785160 extends JApplet {
            JTextArea area = null;
            public void init() {
                super.init();
        try {
                //get default lookandfeel
                System.out.println(UIManager.getLookAndFeel());
                //set nimbuslookandfeel---------------------------
               
        UIManager.setLookAndFeel("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel");
        }catch (Exception ex1) {

        }

                try {
                    area = new JTextArea();
                    getContentPane().add(new JScrollPane(area));
                   
        area.setText("mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm");
                    area.getCaret().setDot(area.getText().length() + 1);
                    area.requestFocus();
                } catch(Exception e) {
                    System.out.println("Unexpected exception :");
                    e.printStackTrace();
                    throw new RuntimeException("Test failed.");
                }
            }
        }
        ---------End code-----------
        2).compile the code:${JDK7_HOME}/bin/javac bug4785160.java
        compile successfully.
        3).run the class file:${JDK7_HOME}/bin/java bug4785160
        4).os default lookandfeel is MetalLookAndFeel,the case fail
        5).set lookandfeel as Nimbus,please see the code's comment¿the case pass.
        #Validation
        same issues happens to;
        Product: j2se
        OS: ubuntu9.04-i586
        JDK/JREBuildNo.: 1.7.0b66
        affects test
        javax/swing/text/DefaultCaret/4785160/bug4785160.java

              ssadetsky Semyon Sadetsky (Inactive)
              tonyli Tony Li (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: