-
Bug
-
Resolution: Unresolved
-
P4
-
None
-
6
-
Cause Known
-
x86
-
windows_xp
FULL PRODUCT VERSION :
1.6.x (tried on 1.6.3, 1.6.5, 1.6.10)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows XP [Version 5.1.2600]
A DESCRIPTION OF THE PROBLEM :
Previous versions of Java (1.5 and before?) would bring up a print dialog that did not contain an icon when the JComponent.print method was invoked.
Now Java 1.6 includes the standard java coffee cup icon in the print dialog when it is invoked this way. This messes up the productization of our application where we are careful to show our own application icon an all windows and dialogs.
If we call ServiceDialog.setDefaultLookAndFeelDecorated( true ), we can get rid of the icon, but then the dialog decoration doesn't match the rest of our application.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Invoke the print method on a JComponent such as a JTable.
example:
JTable jTable = new JTable();
.
.
.
jTable.print();
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The print dialog should not have an icon unless it inherits the icon from the dialog or window of the component that the print method was invoked on.
ACTUAL -
The print dialog contains the standard Java coffee cup icon.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
/*
* PrintTable.java
*
* Created on April 8, 2008, 10:11 AM
*/
package printdialogiconbug;
import java.awt.print.PrinterException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.ImageIcon;
/**
*
* @author rtriebwasser
*/
public class PrintTable extends javax.swing.JFrame {
/** Creates new form PrintTable */
public PrintTable() {
setIconImage( new ImageIcon( getClass().getResource("/printdialogiconbug/AppIcon.png") ).getImage() );
initComponents();
}
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
// <editor-fold defaultstate="collapsed" desc="Generated Code">
private void initComponents() {
jScrollPane = new javax.swing.JScrollPane();
jTable = new javax.swing.JTable();
jButtonPrint = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setTitle("Print Dialog Icon Bug");
jTable.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
{null, null, null, null},
{null, null, null, null},
{null, null, null, null},
{null, null, null, null}
},
new String [] {
"Title 1", "Title 2", "Title 3", "Title 4"
}
));
jScrollPane.setViewportView(jTable);
jButtonPrint.setText("Print");
jButtonPrint.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButtonPrintActionPerformed(evt);
}
});
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 400, Short.MAX_VALUE)
.addGroup(layout.createSequentialGroup()
.addGap(162, 162, 162)
.addComponent(jButtonPrint)
.addContainerGap(183, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(jScrollPane, javax.swing.GroupLayout.PREFERRED_SIZE, 263, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jButtonPrint)
.addContainerGap(13, Short.MAX_VALUE))
);
pack();
}// </editor-fold>
private void jButtonPrintActionPerformed(java.awt.event.ActionEvent evt) {
try {
jTable.print();
} catch (PrinterException ex) {
Logger.getLogger(PrintTable.class.getName()).log(Level.SEVERE, null, ex);
}
}
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new PrintTable().setVisible(true);
}
});
}
// Variables declaration - do not modify
private javax.swing.JButton jButtonPrint;
private javax.swing.JScrollPane jScrollPane;
private javax.swing.JTable jTable;
// End of variables declaration
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
call ServiceDialog.setDefaultLookAndFeelDecorated( true ), but this is probably not acceptable if the rest of your application is using system window decorators.
1.6.x (tried on 1.6.3, 1.6.5, 1.6.10)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows XP [Version 5.1.2600]
A DESCRIPTION OF THE PROBLEM :
Previous versions of Java (1.5 and before?) would bring up a print dialog that did not contain an icon when the JComponent.print method was invoked.
Now Java 1.6 includes the standard java coffee cup icon in the print dialog when it is invoked this way. This messes up the productization of our application where we are careful to show our own application icon an all windows and dialogs.
If we call ServiceDialog.setDefaultLookAndFeelDecorated( true ), we can get rid of the icon, but then the dialog decoration doesn't match the rest of our application.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Invoke the print method on a JComponent such as a JTable.
example:
JTable jTable = new JTable();
.
.
.
jTable.print();
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The print dialog should not have an icon unless it inherits the icon from the dialog or window of the component that the print method was invoked on.
ACTUAL -
The print dialog contains the standard Java coffee cup icon.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
/*
* PrintTable.java
*
* Created on April 8, 2008, 10:11 AM
*/
package printdialogiconbug;
import java.awt.print.PrinterException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.ImageIcon;
/**
*
* @author rtriebwasser
*/
public class PrintTable extends javax.swing.JFrame {
/** Creates new form PrintTable */
public PrintTable() {
setIconImage( new ImageIcon( getClass().getResource("/printdialogiconbug/AppIcon.png") ).getImage() );
initComponents();
}
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
// <editor-fold defaultstate="collapsed" desc="Generated Code">
private void initComponents() {
jScrollPane = new javax.swing.JScrollPane();
jTable = new javax.swing.JTable();
jButtonPrint = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setTitle("Print Dialog Icon Bug");
jTable.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
{null, null, null, null},
{null, null, null, null},
{null, null, null, null},
{null, null, null, null}
},
new String [] {
"Title 1", "Title 2", "Title 3", "Title 4"
}
));
jScrollPane.setViewportView(jTable);
jButtonPrint.setText("Print");
jButtonPrint.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButtonPrintActionPerformed(evt);
}
});
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 400, Short.MAX_VALUE)
.addGroup(layout.createSequentialGroup()
.addGap(162, 162, 162)
.addComponent(jButtonPrint)
.addContainerGap(183, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(jScrollPane, javax.swing.GroupLayout.PREFERRED_SIZE, 263, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jButtonPrint)
.addContainerGap(13, Short.MAX_VALUE))
);
pack();
}// </editor-fold>
private void jButtonPrintActionPerformed(java.awt.event.ActionEvent evt) {
try {
jTable.print();
} catch (PrinterException ex) {
Logger.getLogger(PrintTable.class.getName()).log(Level.SEVERE, null, ex);
}
}
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new PrintTable().setVisible(true);
}
});
}
// Variables declaration - do not modify
private javax.swing.JButton jButtonPrint;
private javax.swing.JScrollPane jScrollPane;
private javax.swing.JTable jTable;
// End of variables declaration
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
call ServiceDialog.setDefaultLookAndFeelDecorated( true ), but this is probably not acceptable if the rest of your application is using system window decorators.