-
Bug
-
Resolution: Fixed
-
P2
-
6, 7
-
b70
-
generic, x86
-
generic, windows_xp
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-2150930 | 6u10 | Sergey Groznyh | P2 | Resolved | Fixed | b13 |
JDK-2159852 | 5.0-pool | Kannan Balasubramanian | P2 | Closed | Not an Issue | |
JDK-2159853 | 1.4-pool | Kannan Balasubramanian | P2 | Closed | Not an Issue |
I:\>java -version
java version "1.5.0_11"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_11-b03)
Java HotSpot(TM) Client VM (build 1.5.0_11-b03, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
I:\>ver
Microsoft Windows XP [Version 5.1.2600]
A DESCRIPTION OF THE PROBLEM :
For several years, I have been displaying marked up DNA sequence in a JTextPane -- DNA is one long string without spaces or line breaks. Until jre 1.5.0_10 on windows, the JTextPane would wrap my text at the last character that would fit in the component -- logical and exactly what I want. but in version 1.5.0_10 line wrapping seems to chunk by AttributeSet (see working code example in "steps to reproduce" below). This makes no sense and it any case breaks existing applications like mine.
Screen shot on how this has affected my production application here:
http://everydaysystems.com/usenet/JTextPane/
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Compile and run the code sample below and run on jre 1.5.0_4 on windows and then on jre1.5.0_10 or higher on windows (I'm not sure how versions in between fare, except that 1.5.0_7 on the mac works fine). You will see very different line wrapping in the JTextPane.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Here is a screenshot of how the line wrapping has changed in version 1.5.0_10
http://everydaysystems.com/usenet/JTextPane/
Line wrapping used to chunk by "character" for string with no internal spaces, now it seems to chunk by AttributeSet.
I want the old version back!
ACTUAL -
I saw line breaks inserted at AttributeSet boundaries. This makes no sense and is a radical and undocumented change from previous versions of the JRE.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.awt.Color;
import java.awt.Font;
import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.JTextPane;
import javax.swing.text.BadLocationException;
import javax.swing.text.Document;
import javax.swing.text.MutableAttributeSet;
import javax.swing.text.SimpleAttributeSet;
import javax.swing.text.StyleConstants;
public class JTextPaneWrapChangeDemo {
public JTextPaneWrapChangeDemo() {
super();
}
public static void main(String[] args) {
JTextPaneWrapChangeDemo demo = new JTextPaneWrapChangeDemo();
demo.run();
}
public void run() {
JFrame frame = new JFrame();
frame.setSize(400, 400);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JTextPane textPane = new JTextPane();
JScrollPane scrollPane = new JScrollPane(textPane);
frame.add(scrollPane);
textPane.setEditable(false);
textPane.setFont(new Font("Courier", Font.PLAIN, 12));
MutableAttributeSet exonAttributeSet = new SimpleAttributeSet();
MutableAttributeSet intronAttributeSet = new SimpleAttributeSet();
StyleConstants.setFontSize(exonAttributeSet, 12);
StyleConstants.setForeground(exonAttributeSet, Color.blue);
StyleConstants.setFontSize(intronAttributeSet, 12);
StyleConstants.setForeground(intronAttributeSet, Color.black);
try {
Document d = textPane.getDocument();
d.insertString(d.getLength(), exon1, exonAttributeSet);
d.insertString(d.getLength(), intron1, intronAttributeSet);
d.insertString(d.getLength(), exon2, exonAttributeSet);
d.insertString(d.getLength(), intron2, intronAttributeSet);
d.insertString(d.getLength(), exon3, exonAttributeSet);
} catch (BadLocationException e) {
System.out.println("bad location exception" + e);
}
frame.show();
}
String exon1 = "ATGCCACCAAAAGCGCGTATAAACTCAAAAAATTCAGTTGAGCAGGAGGGAAGGGTCCTACTTGCAGTATCAGCTTTGAAAAATAAGGAAATTCTCAATATTCGTGAAGCTGCGCGTGTCTATAATGTGCCTTATACTACCCTCCAGCGGCGCCTAAAGGGGCATACTTTTCGAGCTGAATTACGCGCAAATGGCCATAAAATGACTCAGAATGAAGAGGATTCACTTATTAGATGGATTCTATCTATGGATCAACGTGGAGCGGCTCCCCGACCGTCCCATGTACGAGAAATGGCGAATATCCTGCTTGCGCAGCGTGGTTCAACTCCTACCCAGACTGTTGGAGAGAAATGGGTATATAACTTCATTAATCGGCATGATGAGATCAAAACCCGATTCTCTAGGCGCTATAACCACCAGCGTGCTAAATGTGAAGACCCAAAGATTATCCTGGAATGGTTCAATCGTGTCCAGATCACAATAATGCAGCATGGGATTACACTGGAAGATATCTACAACTTTGATGAAACTGGCTTTGCAATGGGCTTAGTAGCTACTGCTAAG";
String intron1 = "GTAGTTACAAGAGCTGAGATGCTTAGTCGGCCCTTCCTTATCCAGCCAGGGAACCGCGAATGGGTTACCTCTATAGAGTGTATTAACTCTACTGGCTGGGTGCTTCCACCATGCATTATCTTCAAGGGAAAGGTCCATATTGAGGACTGGTATTAAGATACAGCCTTACCAGCAGACTGGCGGATCGAGGTCAGTGAGAATGGATGGACGACTGATCAGATTGGATTACGATGGCTTCAAAAAGTCTTTATTCCTGCTACTACCAGTCGTACAACTGGTAGATATCGACTATTAATTCTTGATGGCCATGGGAGCCATCTAACACCACAGTTTGATCAAATCTGCACTGAGAATGATATCATTCCAATCTGCATGCCTGCACATTCATCACATCTCCTCCAGCCTCTAGATGTTGGCTGTTTCTCTCCTCTTAAGCGTGCGTATGGCCGCTTGATTGAGGATAAGATGCGGCTTGGTTTCAACCATATTGACAAGTTTGATTTCCTTGAGGCCTATCCACAAGCTCATACGGCAATCTTTTCAGCAGATAATATTAAAAGTGGCTTTTCAGCAACTGGATTAATACCACTGAATCCAGATCGGGTGCTCAGTCAGCTTAATATCCAGCTTAGAACACCTACACCACCAGGCAGCCGATCAACTAATTCTGTCCCAAAAACACCTTACAATCTCAAGCA";
String exon2 = "GCTGAAGAAGCAGGAAACTACGCTTAAGAAGCTACTTAGGGAGCGTACATACAGCCCTCCTACCCCTACAAAGGCTGTGCTAGGTCAGATTATCAAGGGGTGTGAGATGGCAATGAATAACGCTGCCCTTCTTGCAAAGGAAAATCATGATCTACGTGCTGCACATGAAAAGCACCTTCAAAAGCAGAAGCGATCTAGGCGGCAGATAGAAACTGCA";
String intron2 = "GTGGGATTATCTATCCAGGAAGGGCAGGAGATCATTTAACGCAGGGATCAGGCTGCTGAAGCTATCCCAACTATCCCTCCAGAGCAGGTAGTAGATACAGAACAACGCCCTCAACGGGCACCCCCACGCTGCAGTGACTGCCATATTCTAGGCCATAGGCGATTGCAATGTCCGCAGCGCAAGAATAACTAGATTTAGTAATAAAATCATGTTTTAGGGGTTCAAAATAGCCTCCAATTTCGGCCGCGGCCAAATTCTATAG";
String exon3 = "TATGGTGATCCGCTCGGTTACGTGATCCGCTCGCTTACCGATTACGTTACTTCTCTGGAAGACGATCCTGGACTAAGTCATTTCCTTTTGCGTAGTTCAGCGGATTTTTTTTTTCTTCTGCTACTTGGGGTCGCTGAAGATGGAATCAATCAGACGT";
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Tell users to use an older JRE. This is not satisfactory.
Release Regression From : 5.0u7
The above release value was the last known release where this
bug was not reproducible. Since then there has been a regression.
- backported by
-
JDK-2150930 JTextPane line wrap radically different from previous versions in jre 1.5.0_10+
- Resolved
-
JDK-2159852 JTextPane line wrap radically different from previous versions in jre 1.5.0_10+
- Closed
-
JDK-2159853 JTextPane line wrap radically different from previous versions in jre 1.5.0_10+
- Closed
- duplicates
-
JDK-6751407 GlyphView.getMinimumSpan return value is not the minimum span
- Closed
- relates to
-
JDK-6973777 JCK manual case JEditorPaneTests.html#JEditorPane fails in jdk7 b100
- Closed
-
JDK-6306218 JEditorPane is unable to do reasonably spaced indentation in complex HTML tables
- Resolved
-
JDK-7125737 JTextPane wrap behaviour on long words changed in Java 7
- Closed
-
JDK-6423287 PargraphView returns wrong minimum span
- Closed
-
JDK-6978666 closed/javax/swing/text/html/TableView/4813831/bug4813831.java failed
- Closed
-
JDK-7027641 Regression: HTML table rendering broken with image/text combination
- Closed
-
JDK-8080135 JTextpane visibleEditorRect has no effect on java 7 and java 8
- Closed