-
Bug
-
Resolution: Won't Fix
-
P3
-
6u10
-
x86
-
windows_xp
FULL PRODUCT VERSION :
java version "1.6.0_17"
Java(TM) SE Runtime Environment (build 1.6.0_17-b04)
Java HotSpot(TM) Client VM (build 14.3-b01, mixed mode, sharing)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows XP [Version 5.1.2600]
A DESCRIPTION OF THE PROBLEM :
Create text area with a line that wraps after the 90th character and print the text area. The 90th character (8) isn't printed when using Java SE 1.6.0 and 1.7.0. It is printed when using Java SE 1.3.1, 1.4.2 and 1.5.0.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
See description
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
See description
ACTUAL -
See description
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.awt.*;
import java.awt.print.*;
import javax.swing.*;
public class Test implements Pageable, Printable {
private JTextArea ta;
private PageFormat pf;
public Test() {
ta = new JTextArea(10, 90);
ta.setFont(new Font("Courier New", Font.PLAIN, 10));
ta.setLineWrap(true);
ta.setWrapStyleWord(true);
ta.append("123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890\n");
ta.append("Hello worlds when this were off you and you were off everyone. The world were this in 2008 extra");
JFrame f = new JFrame("Test");
f.getContentPane().add(new JScrollPane(ta, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER));
f.pack();
Paper p = new Paper();
p.setSize(72.0 * 8.5, 72.0 * 11.0);
p.setImageableArea(72.0 * 0.5, 72.0 * 0.5, 72.0 * 7.5, 72.0 * 10.0);
pf = new PageFormat();
pf.setOrientation(PageFormat.PORTRAIT);
pf.setPaper(p);
PrinterJob pj = PrinterJob.getPrinterJob();
pj.setPrintable(this, pf);
pj.setPageable(this);
if (pj.printDialog()) {
try {
pj.print();
}
catch (PrinterException e) {
}
}
}
public int getNumberOfPages() {
return 1;
}
public PageFormat getPageFormat(int pageIndex) throws IndexOutOfBoundsException {
return pf;
}
public Printable getPrintable(int pageIndex) throws IndexOutOfBoundsException {
return this;
}
public int print(Graphics g, PageFormat pf, int pi) throws PrinterException {
if (pi < 1) {
Rectangle c = g.getClip().getBounds();
g.translate(c.x, c.y);
ta.print(g);
return Printable.PAGE_EXISTS;
}
return Printable.NO_SUCH_PAGE;
}
public static void main(String[] arguments) {
new Test();
}
}
---------- END SOURCE ----------
Release Regression From : 5
The above release value was the last known release where this
bug was not reproducible. Since then there has been a regression.
java version "1.6.0_17"
Java(TM) SE Runtime Environment (build 1.6.0_17-b04)
Java HotSpot(TM) Client VM (build 14.3-b01, mixed mode, sharing)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows XP [Version 5.1.2600]
A DESCRIPTION OF THE PROBLEM :
Create text area with a line that wraps after the 90th character and print the text area. The 90th character (8) isn't printed when using Java SE 1.6.0 and 1.7.0. It is printed when using Java SE 1.3.1, 1.4.2 and 1.5.0.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
See description
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
See description
ACTUAL -
See description
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.awt.*;
import java.awt.print.*;
import javax.swing.*;
public class Test implements Pageable, Printable {
private JTextArea ta;
private PageFormat pf;
public Test() {
ta = new JTextArea(10, 90);
ta.setFont(new Font("Courier New", Font.PLAIN, 10));
ta.setLineWrap(true);
ta.setWrapStyleWord(true);
ta.append("123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890\n");
ta.append("Hello worlds when this were off you and you were off everyone. The world were this in 2008 extra");
JFrame f = new JFrame("Test");
f.getContentPane().add(new JScrollPane(ta, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER));
f.pack();
Paper p = new Paper();
p.setSize(72.0 * 8.5, 72.0 * 11.0);
p.setImageableArea(72.0 * 0.5, 72.0 * 0.5, 72.0 * 7.5, 72.0 * 10.0);
pf = new PageFormat();
pf.setOrientation(PageFormat.PORTRAIT);
pf.setPaper(p);
PrinterJob pj = PrinterJob.getPrinterJob();
pj.setPrintable(this, pf);
pj.setPageable(this);
if (pj.printDialog()) {
try {
pj.print();
}
catch (PrinterException e) {
}
}
}
public int getNumberOfPages() {
return 1;
}
public PageFormat getPageFormat(int pageIndex) throws IndexOutOfBoundsException {
return pf;
}
public Printable getPrintable(int pageIndex) throws IndexOutOfBoundsException {
return this;
}
public int print(Graphics g, PageFormat pf, int pi) throws PrinterException {
if (pi < 1) {
Rectangle c = g.getClip().getBounds();
g.translate(c.x, c.y);
ta.print(g);
return Printable.PAGE_EXISTS;
}
return Printable.NO_SUCH_PAGE;
}
public static void main(String[] arguments) {
new Test();
}
}
---------- END SOURCE ----------
Release Regression From : 5
The above release value was the last known release where this
bug was not reproducible. Since then there has been a regression.