Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6784965

Printing JTable using Sans Serif 11pt is broken

XMLWordPrintable

    • 2d
    • x86
    • linux, solaris, windows_vista, windows_7

      FULL PRODUCT VERSION :
      java 1.6.0_10

      ADDITIONAL OS VERSION INFORMATION :
      Windows Vista Business SP1

      EXTRA RELEVANT SYSTEM CONFIGURATION :
      Also observed on Windows XP

      A DESCRIPTION OF THE PROBLEM :
      When printing JTable with renderers of any kind that use the font Font.SANS_SERIF, 11pt, PLAIN, the characters in cells overlaps with each other (within the same cell)

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      See source code

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Displayed text in cells should not overlap
      ACTUAL -
      In many cases, particularly with upper case characters, text in completely garbled, with characters overlapping each other

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      public static void main(String[] x)
        {
          try
          {
            JTable table = new JTable(1, 1);
            table.setValueAt("CURR ASSETS-CASH", 0, 0);
            table.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 11));
            /*text appears fine in table in option pane*/
            JOptionPane.showMessageDialog(null, new JScrollPane(table));
            /*text overlaps*/
            table.print();
            System.exit(0);
          }
          catch(PrinterException ex)
          {
            ex.printStackTrace();
          }
        }
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      The only workaround is to use a font such as Lucida Sans or Tahoma which is somewhat similar but seems not to have the same problems when printing

      Release Regression From : 6u7
      The above release value was the last known release where this
      bug was not reproducible. Since then there has been a regression.

            prr Philip Race
            ndcosta Nelson Dcosta (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Imported:
              Indexed: