-
Bug
-
Resolution: Unresolved
-
P5
-
None
-
6
-
x86
-
windows_xp
FULL PRODUCT VERSION :
JRE 6 u1 and JRE 7 beta 12.
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows XP [Version 5.1.2600]
EXTRA RELEVANT SYSTEM CONFIGURATION :
Nvidia Geforce 7600 GS with new drivers.
A DESCRIPTION OF THE PROBLEM :
Passing a negative value for StyleConstants.setFirstLineIndent seems to invalidate the contrast of the first line text in the text-component.
By invalidating contrast, I mean that for some reason the first line gets a very high contrast, compared to other lines of the paragraph. The result is same as modifying the RenderingHint KEY_TEXT_LCD_CONTRAST by some value (except that only the first line is affected).
Selecting the text (with mouse), will make the problem go away (as long as the first line is selected), so only non-selected text is affected.
This problem occurs only with text anti-aliasing enabled.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
I can reproduce the bug always.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import javax.swing.*;
import javax.swing.text.Style;
import javax.swing.text.StyleConstants;
import javax.swing.text.StyledDocument;
import javax.swing.text.BadLocationException;
import java.awt.*;
public class IndentTest {
public static void main(String[] args) {
JFrame f = new JFrame();
f.setLocationByPlatform(true);
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.setSize(400,300);
JTextPane p = new JTextPane();
p.setSelectionColor(Color.WHITE);
Style set = p.addStyle("default", null);
float indent = 50.0f;
StyleConstants.setFontFamily(set, "Lucida Sans Typewriter");
StyleConstants.setLeftIndent(set, indent);
StyleConstants.setFirstLineIndent(set, -indent);
p.setLogicalStyle(set);
StyledDocument doc = p.getStyledDocument();
try {
doc.insertString(
doc.getLength(),
"The contrast of the first line is larger than than the rest of the rows.\n",
null);
}
catch (BadLocationException e) {
e.printStackTrace();
}
f.setContentPane(p);
f.setVisible(true);
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
None that I know of.
JRE 6 u1 and JRE 7 beta 12.
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows XP [Version 5.1.2600]
EXTRA RELEVANT SYSTEM CONFIGURATION :
Nvidia Geforce 7600 GS with new drivers.
A DESCRIPTION OF THE PROBLEM :
Passing a negative value for StyleConstants.setFirstLineIndent seems to invalidate the contrast of the first line text in the text-component.
By invalidating contrast, I mean that for some reason the first line gets a very high contrast, compared to other lines of the paragraph. The result is same as modifying the RenderingHint KEY_TEXT_LCD_CONTRAST by some value (except that only the first line is affected).
Selecting the text (with mouse), will make the problem go away (as long as the first line is selected), so only non-selected text is affected.
This problem occurs only with text anti-aliasing enabled.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
I can reproduce the bug always.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import javax.swing.*;
import javax.swing.text.Style;
import javax.swing.text.StyleConstants;
import javax.swing.text.StyledDocument;
import javax.swing.text.BadLocationException;
import java.awt.*;
public class IndentTest {
public static void main(String[] args) {
JFrame f = new JFrame();
f.setLocationByPlatform(true);
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.setSize(400,300);
JTextPane p = new JTextPane();
p.setSelectionColor(Color.WHITE);
Style set = p.addStyle("default", null);
float indent = 50.0f;
StyleConstants.setFontFamily(set, "Lucida Sans Typewriter");
StyleConstants.setLeftIndent(set, indent);
StyleConstants.setFirstLineIndent(set, -indent);
p.setLogicalStyle(set);
StyledDocument doc = p.getStyledDocument();
try {
doc.insertString(
doc.getLength(),
"The contrast of the first line is larger than than the rest of the rows.\n",
null);
}
catch (BadLocationException e) {
e.printStackTrace();
}
f.setContentPane(p);
f.setVisible(true);
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
None that I know of.