-
Bug
-
Resolution: Fixed
-
P4
-
1.3.0
-
beta
-
x86
-
windows_95, windows_nt
Name: skT45625 Date: 07/31/2000
C:\jdk1.3\bin>java -version
java version "1.3.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0-C)
Java HotSpot(TM) Client VM (build 1.3.0-C, mixed mode)
There appears to be some problems with the HTML Editor Kit in JRE version 1.3.0
on windows NT and 95/98.
We have set up a standard HTML Editor Kit in the same way as below and are
observing strange behavior as described below.
<pre>
import java.awt.*;
import java.awt.event.*;
import java.util.*;
import javax.swing.*;
import javax.swing.text.html.*;
public class editorTest {
JEditorPane edit = new JEditorPane();
HTMLEditorKit htmleditorKit = new HTMLEditorKit();
JButton btnBullet = new JButton();
Action[] actions;
Hashtable commands = new Hashtable();
public editorTest() {
JFrame frame = new JFrame();
frame.getContentPane().setLayout(new BorderLayout());
actions = htmleditorKit.getActions();
for (int i=0; i<actions.length; i++){
Action a = actions[i];
commands.put(a.getValue(Action.NAME), a);
}
edit.setEditorKit(htmleditorKit);
edit.setDocument(htmleditorKit.createDefaultDocument());
btnBullet.setText("Bullet");
btnBullet.addActionListener((Action)commands.get
("InsertUnorderedListItem"));
frame.getContentPane().add(edit, BorderLayout.CENTER);
frame.getContentPane().add(btnBullet, BorderLayout.SOUTH);
frame.setSize(new Dimension(400,400));
frame.setVisible(true);
frame.addWindowListener(new WindowAdapter(){
public void windowClosing(WindowEvent e)
{
System.exit(0);
}
});
}
//Main method
public static void main(String[] args) {
new editorTest();
}
}
</pre>
To reproduce the problems perform the following...
(1) Press the bullet button now put the caret to the right of the newly created
bullet and type some text. This text is being entered on the line below where
the bullet appears.
(2) Clear everything from the screen and press the bullet button again put the
caret to the right of this newly created bullet press the back arrow once. Now
type some text and the text will appear on the right line but the text is
center aligned, standard behavoiur indicates that it should be left aligned.
(3) Put the caret on the line below this bullet and type some text. Now
backspace all of this text and keep pressing backspace. The text on the line
with the bullet is actually being backspaced but the caret is staying on the
line below.
(4) The up and down arrows do not move the caret up or down when the caret runs
into a bullet or is within a bullet.
I have had a look at the code and believe most of these problems are related to
the editor kit caret location not being placed inside the tags correctly.
Any workarounds for this problem would be greatly appreciated as we need to get
this control working correctly ASAP.
Geoff Green
###@###.###
(Review ID: 107785)
======================================================================
- duplicates
-
JDK-4323105 JEditorPane, insert ordered/unordered list, the content is not left-justified
-
- Closed
-
- relates to
-
JDK-4115562 swing.text.LabelView.viewToModel(float, float, Shape) doesn't work properly
-
- Closed
-