How to print multiple header lines with MessageFormat using a JTable

后端 未结 5 1950
故里飘歌
故里飘歌 2020-12-06 03:32

I have a table called table and its filled with data, I also have a MessageFormat header I want to use as a header to print the JTable

5条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-06 03:37

    You could try

    StringBuilder builder = new StringBuilder();
    builder.append("Product: ");
    builder.append(task.getProductName());
    builder.append(System.getProperty("line.separator"));
    builder.append("Job: ");
    builder.append(task.getJobNumber());
    builder.append(System.getProperty("line.separator"));
    builder.append("Task: ");
    builder.append(task.getTaskID();
    
    MessageFormat header = new MessageFormat(builder.toString());
    

    If this doesn't work, then you're going to have to set up your own printer job, and layout the header precisely as you want it.

提交回复
热议问题