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.
1.4.2 mantisFixed
Related Reports
Duplicate :  

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);

                     JEditorPane jep = new JEditorPane("text/html", str);
                     this.getContentPane().setLayout(new BorderLayout());
                     this.getContentPane().add(new JScrollPane(jep), BorderLayout.CENTER);
              }catch(Exception e){
              addWindowListener(new WindowAdapter() {
                     public void windowClosing(WindowEvent event) {
              setSize(400, 400);
       protected String readHTMLFile(String filename){
              BufferedReader reader = null;
              StringBuffer buff = new StringBuffer();
                     reader = new BufferedReader(new FileReader(filename));
                     while (reader.ready()){
                            buff.append(reader.readLine() + "\n");
              }catch(Exception e){
                     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 --------------------------
Input: <input name="text1" value="hello" size="80">
TextArea: <textarea name="text2" rows="10" cols="80">hello world</textarea>


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

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

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