-
Bug
-
Resolution: Duplicate
-
P3
-
None
-
1.4.0, 1.4.2_09
-
x86
-
windows_2000
Name: jk109818 Date: 10/04/2002
FULL PRODUCT VERSION :
java version "1.4.0_01"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0_01-b03)
Java HotSpot(TM) Client VM (build 1.4.0_01-b03, mixed mode)
java version "1.4.0_02"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0_02-b02)
Java HotSpot(TM) Client VM (build 1.4.0_02-b02, mixed mode)
java version "1.4.1"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1-b21)
Java HotSpot(TM) Client VM (build 1.4.1-b21, mixed mode)
FULL OPERATING SYSTEM VERSION :
Microsoft Windows 2000 [Version 5.00.2195] SP2
Windows Millenium [Version 4.90.3000]
EXTRA RELEVANT SYSTEM CONFIGURATION :
HP Deskjet 682C, HP Deskjet 540C, Epson Stylus Color 640
A DESCRIPTION OF THE PROBLEM :
Printing a component using the Java 1.2 API Printable and
Pageable interfaces and Graphics2D object worked under JRE
1.3.1 but doesn't under JRE 1.4.0_01,_02. The component
prints, but the text does not, unless the color is set to
Color.Blue or some variation of Blue. Using
java.awt.Color(0,0,255) for the text results in printed
text, blue if printed in color and black in B/W. As you
change the color closer to (0,0,0), the result is lighter,
until the result is no printed text. If there is a
background to the object, the text results as white shadow
on the background. All Green text, All Red text and All
Black text do not print. All Colors display properly on the
object on the screen, but do not print.
The problem occurs with a HP 682C, HP 540C and Epson 640
printers. A Canon C755 prints the text OK but seems to have
other problems with the bottom margin(not this specific bug).
REGRESSION. Last worked in version 1.3.1
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1.Create a class PrintableTable that extends JFrame
implements Printable, see source code below.
2.Run and print with HP 682C Inkjet printer. See results below.
3.Try changing the title text foreground to blue, then other
colors. Only blue prints in color or B/W.
EXPECTED VERSUS ACTUAL BEHAVIOR :
Running this results in a Window that displays a table with
2 columns and 2 rows. The table has a header. There is a
title above the table and a button below the table. Text is
displayed in both the title and the table.
Press the button and the print dialogs display allowing the
selection of format and printer.
The resulting printout displays a white shadow of the
"Title" text and the "Column" and "Header" column headers
and no text in the table.
The resulting printout should print the text in the Title
label as well as the table header and cells.
If the title foreground is changed to blue, the text prints.
If the title foreground is changed to red, the text shadow
results.
ERROR MESSAGES/STACK TRACES THAT OCCUR :
no error messages.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
package test1;
import java.awt.*;
import java.awt.print.*;
public class PrintableTable extends javax.swing.JFrame implements Printable {
Component c;
public PrintableTable() {
super("Simple JTable Test");
setSize(300,150);
javax.swing.JPanel titlePanel = new javax.swing.JPanel(new FlowLayout());
javax.swing.JLabel title = new javax.swing.JLabel("Title");
titlePanel.add(title);
javax.swing.JTable jt = new javax.swing.JTable (new String[][] {{"this", "is"},
{"a", "Test"}}, new String[] {"Column", "Header"});
javax.swing.JScrollPane jsp = new javax.swing.JScrollPane(jt);
javax.swing.JPanel panel = new javax.swing.JPanel(new BorderLayout());
panel.setBackground(Color.white);
panel.add(titlePanel, BorderLayout.NORTH);
panel.add(jsp, BorderLayout.CENTER);
getContentPane().add(panel, BorderLayout.CENTER);
this.c = panel;
javax.swing.JButton button = new javax.swing.JButton("Print");
getContentPane().add(button,BorderLayout.SOUTH);
button.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed (java.awt.event.ActionEvent e) {
try {
print();
}
catch (java.lang.Throwable exc) {
System.out.println("Printer Exception");
}
}
});
}
public static void main(String[] args) {
PrintableTable pt = new PrintableTable();
pt.setVisible(true);
}
public void print() throws java.awt.print.PrinterException {
PrinterJob job = PrinterJob.getPrinterJob();
PageFormat format = job.pageDialog(job.defaultPage());
job.setPrintable(this,format);
if (job.printDialog())
job.print();
}
public int print(Graphics graphics, PageFormat pageFormat, int pageIndex) throws
PrinterException {
if (pageIndex > 0)
return Printable.NO_SUCH_PAGE;
Graphics2D g2 = (Graphics2D) graphics;
g2.translate(pageFormat.getImageableX(),pageFormat.getImageableY());
c.paint(g2);
return Printable.PAGE_EXISTS;
}
}
---------- END SOURCE ----------
CUSTOMER WORKAROUND :
Print in blue text only. But no way to determine printer.
Since the in my application, the table column renderer is
used both for the user interface and printing of table, it
is unacceptable. This impacts the user interface use of
color for distinguishing data states.
Release Regression From : 1.3.1
The above release value was the last known release where this
bug was known to work. Since then there has been a regression.
(Review ID: 164896)
======================================================================
FULL PRODUCT VERSION :
java version "1.4.0_01"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0_01-b03)
Java HotSpot(TM) Client VM (build 1.4.0_01-b03, mixed mode)
java version "1.4.0_02"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0_02-b02)
Java HotSpot(TM) Client VM (build 1.4.0_02-b02, mixed mode)
java version "1.4.1"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1-b21)
Java HotSpot(TM) Client VM (build 1.4.1-b21, mixed mode)
FULL OPERATING SYSTEM VERSION :
Microsoft Windows 2000 [Version 5.00.2195] SP2
Windows Millenium [Version 4.90.3000]
EXTRA RELEVANT SYSTEM CONFIGURATION :
HP Deskjet 682C, HP Deskjet 540C, Epson Stylus Color 640
A DESCRIPTION OF THE PROBLEM :
Printing a component using the Java 1.2 API Printable and
Pageable interfaces and Graphics2D object worked under JRE
1.3.1 but doesn't under JRE 1.4.0_01,_02. The component
prints, but the text does not, unless the color is set to
Color.Blue or some variation of Blue. Using
java.awt.Color(0,0,255) for the text results in printed
text, blue if printed in color and black in B/W. As you
change the color closer to (0,0,0), the result is lighter,
until the result is no printed text. If there is a
background to the object, the text results as white shadow
on the background. All Green text, All Red text and All
Black text do not print. All Colors display properly on the
object on the screen, but do not print.
The problem occurs with a HP 682C, HP 540C and Epson 640
printers. A Canon C755 prints the text OK but seems to have
other problems with the bottom margin(not this specific bug).
REGRESSION. Last worked in version 1.3.1
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1.Create a class PrintableTable that extends JFrame
implements Printable, see source code below.
2.Run and print with HP 682C Inkjet printer. See results below.
3.Try changing the title text foreground to blue, then other
colors. Only blue prints in color or B/W.
EXPECTED VERSUS ACTUAL BEHAVIOR :
Running this results in a Window that displays a table with
2 columns and 2 rows. The table has a header. There is a
title above the table and a button below the table. Text is
displayed in both the title and the table.
Press the button and the print dialogs display allowing the
selection of format and printer.
The resulting printout displays a white shadow of the
"Title" text and the "Column" and "Header" column headers
and no text in the table.
The resulting printout should print the text in the Title
label as well as the table header and cells.
If the title foreground is changed to blue, the text prints.
If the title foreground is changed to red, the text shadow
results.
ERROR MESSAGES/STACK TRACES THAT OCCUR :
no error messages.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
package test1;
import java.awt.*;
import java.awt.print.*;
public class PrintableTable extends javax.swing.JFrame implements Printable {
Component c;
public PrintableTable() {
super("Simple JTable Test");
setSize(300,150);
javax.swing.JPanel titlePanel = new javax.swing.JPanel(new FlowLayout());
javax.swing.JLabel title = new javax.swing.JLabel("Title");
titlePanel.add(title);
javax.swing.JTable jt = new javax.swing.JTable (new String[][] {{"this", "is"},
{"a", "Test"}}, new String[] {"Column", "Header"});
javax.swing.JScrollPane jsp = new javax.swing.JScrollPane(jt);
javax.swing.JPanel panel = new javax.swing.JPanel(new BorderLayout());
panel.setBackground(Color.white);
panel.add(titlePanel, BorderLayout.NORTH);
panel.add(jsp, BorderLayout.CENTER);
getContentPane().add(panel, BorderLayout.CENTER);
this.c = panel;
javax.swing.JButton button = new javax.swing.JButton("Print");
getContentPane().add(button,BorderLayout.SOUTH);
button.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed (java.awt.event.ActionEvent e) {
try {
print();
}
catch (java.lang.Throwable exc) {
System.out.println("Printer Exception");
}
}
});
}
public static void main(String[] args) {
PrintableTable pt = new PrintableTable();
pt.setVisible(true);
}
public void print() throws java.awt.print.PrinterException {
PrinterJob job = PrinterJob.getPrinterJob();
PageFormat format = job.pageDialog(job.defaultPage());
job.setPrintable(this,format);
if (job.printDialog())
job.print();
}
public int print(Graphics graphics, PageFormat pageFormat, int pageIndex) throws
PrinterException {
if (pageIndex > 0)
return Printable.NO_SUCH_PAGE;
Graphics2D g2 = (Graphics2D) graphics;
g2.translate(pageFormat.getImageableX(),pageFormat.getImageableY());
c.paint(g2);
return Printable.PAGE_EXISTS;
}
}
---------- END SOURCE ----------
CUSTOMER WORKAROUND :
Print in blue text only. But no way to determine printer.
Since the in my application, the table column renderer is
used both for the user interface and printing of table, it
is unacceptable. This impacts the user interface use of
color for distinguishing data states.
Release Regression From : 1.3.1
The above release value was the last known release where this
bug was known to work. Since then there has been a regression.
(Review ID: 164896)
======================================================================
- duplicates
-
JDK-4733565 Wrong mapping of JLabel etc. foreground color when b/w printing
- Closed
- relates to
-
JDK-4258020 Java 2D printing API : images are B&W on PCL printers on win95/98 only
- Closed