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

JTable.print does not propertly print Japanese characters

    XMLWordPrintable

    Details

      Description

      ADDITIONAL SYSTEM INFORMATION :
      This worked in earlier releases

      A DESCRIPTION OF THE PROBLEM :
      The result is tofu (boxes and random symbols)

      REGRESSION : Last worked in version 8u192

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Run the attached file which brings up a print dialog. Print to a printer or save to file.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Expected to see proper Japanese characters
      ACTUAL -
      The result is tofu (boxes and random symbols)

      ---------- BEGIN SOURCE ----------
      import javax.swing.*;
      import java.awt.print.PrinterException;

      public class Main {

          public static void main(String[] args) {

              System.out.println("Creating table with strings:");

              JTable table = new JTable(5, 5);
              String st1 = "test";
              String st2 = "\u6A5F\u80FD\u7859\u6dF1.m";
              System.out.println(st1);
              System.out.println(st2);

              table.setValueAt(st1, 2, 3);
              table.setValueAt(st2, 3, 4);

              JFrame frame = new JFrame("Table Test");
              frame.add(table);
              frame.setSize(800, 300);
              frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              frame.setVisible(true);

              try {
                  Thread.sleep(3000);
              } catch (InterruptedException e) {
                  e.printStackTrace();
              }

              try {
                  table.print();
              } catch (PrinterException e) {
                  e.printStackTrace();
              }
          }
      }

      ---------- END SOURCE ----------

      FREQUENCY : always


        Attachments

          Activity

            People

            • Assignee:
              pardesha Pardeep Sharma
              Reporter:
              webbuggrp Webbug Group
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: