JDK-4712089 : REGRESSION 1.4.0: Focus moves incorrectly on JEditorPane using HTMLEditor Kit an
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 1.4.0,1.4.1
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic,linux
  • CPU: generic,x86
  • Submitted: 2002-07-09
  • Updated: 2002-09-28
  • Resolved: 2002-09-28
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
1.4.2 mantisFixed
Related Reports
Duplicate :  
Description

Name: dk106046			Date: 07/09/2002

java version "1.4.1-rc"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1-rc-b16)
Java HotSpot(TM) Client VM (build 1.4.1-rc-b16, mixed mode)

Steps to reproduce:

1) Compile the JEditorPaneTest.java listed below.
2) Prepare the test.html listed below
3) run "java JEditorPaneTest test.html"
4) Once the JEditorPaneTest is up, you should see a Input field and TextArea field, generated by html form.
5) Click the Input field (first one)
6) Type any character - you should notice that the focus jump to the TextArea instead of stay with TextArea <---------- PROBLEM!

-------------- Sample code: JEditorPaneTest.java -------------------
/*
 * JEditorPaneTest.java
 */
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.io.*;

public class JEditorPaneTest extends JFrame {
       Component c;
       public JEditorPaneTest(String filename) {
              super("JEditorPane Test");
              String str = readHTMLFile(filename);

              try{
                     JEditorPane jep = new JEditorPane("text/html", str);
                      jep.setEditable(false);
                     this.getContentPane().setLayout(new BorderLayout());
                     this.getContentPane().add(new JScrollPane(jep), BorderLayout.CENTER);
              }catch(Exception e){
                     e.printStackTrace();
              }
              addWindowListener(new WindowAdapter() {
                     public void windowClosing(WindowEvent event) {
                            System.exit(0);
                     }
              });
              setSize(400, 400);
              show();
       }
       protected String readHTMLFile(String filename){
              BufferedReader reader = null;
              StringBuffer buff = new StringBuffer();
              try{
                     reader = new BufferedReader(new FileReader(filename));
                     while (reader.ready()){
                            buff.append(reader.readLine() + "\n");
                     }
              }catch(Exception e){
                     e.printStackTrace();
              }finally{
                     if (reader != null){
                            try{ reader.close(); }catch(Exception e){ e.printStackTrace(); }
                     }
              }
              return buff.toString();
       }
       public static void main(String[] args) {
              new JEditorPaneTest(args[0]);
       }
}

--------------------------------------------------------------------

------------------ Sample File: test.html --------------------------
<html>
<body>
<form>
Input: <input name="text1" value="hello" size="80">
<p>
TextArea: <textarea name="text2" rows="10" cols="80">hello world</textarea>
</form>
</body>
</html>
--------------------------------------------------------------------

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

Comments
CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: generic mantis FIXED IN: mantis INTEGRATED IN: mantis mantis-b03
14-06-2004

SUGGESTED FIX see http://sa.sfbay.sun.com/swing/mantis/4712089/ for the details ###@###.### 2002-09-17
17-09-2002

EVALUATION The problem is with FlowLayout.FlowStrategy.adjustRow it does r.replace. when it happens for componentView the focus moves to the next component. ###@###.### 2002-09-17
17-09-2002