• <legend id='KurWf'><style id='KurWf'><dir id='KurWf'><q id='KurWf'></q></dir></style></legend>
  • <tfoot id='KurWf'></tfoot>
    1. <small id='KurWf'></small><noframes id='KurWf'>

      1. <i id='KurWf'><tr id='KurWf'><dt id='KurWf'><q id='KurWf'><span id='KurWf'><b id='KurWf'><form id='KurWf'><ins id='KurWf'></ins><ul id='KurWf'></ul><sub id='KurWf'></sub></form><legend id='KurWf'></legend><bdo id='KurWf'><pre id='KurWf'><center id='KurWf'></center></pre></bdo></b><th id='KurWf'></th></span></q></dt></tr></i><div id='KurWf'><tfoot id='KurWf'></tfoot><dl id='KurWf'><fieldset id='KurWf'></fieldset></dl></div>
        • <bdo id='KurWf'></bdo><ul id='KurWf'></ul>

        获取 JTable 以打印表格格式

        时间:2023-09-29
          <tbody id='qI4Xf'></tbody>
        <tfoot id='qI4Xf'></tfoot>
      2. <small id='qI4Xf'></small><noframes id='qI4Xf'>

            <bdo id='qI4Xf'></bdo><ul id='qI4Xf'></ul>
            <i id='qI4Xf'><tr id='qI4Xf'><dt id='qI4Xf'><q id='qI4Xf'><span id='qI4Xf'><b id='qI4Xf'><form id='qI4Xf'><ins id='qI4Xf'></ins><ul id='qI4Xf'></ul><sub id='qI4Xf'></sub></form><legend id='qI4Xf'></legend><bdo id='qI4Xf'><pre id='qI4Xf'><center id='qI4Xf'></center></pre></bdo></b><th id='qI4Xf'></th></span></q></dt></tr></i><div id='qI4Xf'><tfoot id='qI4Xf'></tfoot><dl id='qI4Xf'><fieldset id='qI4Xf'></fieldset></dl></div>
              <legend id='qI4Xf'><style id='qI4Xf'><dir id='qI4Xf'><q id='qI4Xf'></q></dir></style></legend>

                • 本文介绍了获取 JTable 以打印表格格式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  所以我有一个标准的 JTable,我希望用户能够打印出来.我使用了 JTable.print(),它可以打印出表格的精确副本,但我希望它更多地采用表格格式,只有列名,然后是它们下面的数据,没有网格或任何东西.我以为这很简单,但我不知道该怎么做!有人做过吗?如果是这样,有人可以为我提供代码示例/示例吗?谢谢.

                  So I have a standard JTable and I want the user to be able to print it out. I used JTable.print() and that's fine for printing out an exact replica of the table, but I was hoping to have it more in a tabular format, with just the column names and then the data beneath them, no grids or anything. I thought this would be simple, but I have no clue what to do! Has anybody done this? If so, can someone provide me with code sample/example? Thank you.

                  推荐答案

                  你可以禁用网格线,例如...

                  You could disable the grid lines, for example...

                  JTable printTable = new JTable(table.getModel());
                  printTable.setSize(printTable.getPreferredSize());
                  JTableHeader tableHeader = printTable.getTableHeader();
                  tableHeader.setSize(tableHeader.getPreferredSize());
                  
                  printTable.setShowHorizontalLines(false);
                  printTable.setShowVerticalLines(false);
                  printTable.print(JTable.PrintMode.FIT_WIDTH);
                  

                  这使用一个临时的、屏幕外的 JTable 来进行实际打印,因此您需要确保配置任何所需的渲染器,但这个想法是合理的.

                  This uses a temporary, offscreen JTable to do the actually printing, so you will need to be sure to configure any required renderers, but the idea is sound.

                  此基本功能可确保屏幕上的 JTable 不会随着更改而更新,这可能会让用户感到害怕.

                  This basic ensures that the JTable that is on the screen doesn't get updated with the changed, which could be kind of freaking to users.

                  它还允许您根据需要更改 TableHeader ;)

                  It also allows you to change the TableHeader should you want to to ;)

                  这篇关于获取 JTable 以打印表格格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:如何用前导零写入csv? 下一篇:简单日期格式.返回错误日期的格式

                  相关文章

                  最新文章

                    <bdo id='0Glvr'></bdo><ul id='0Glvr'></ul>

                    1. <tfoot id='0Glvr'></tfoot>
                    2. <small id='0Glvr'></small><noframes id='0Glvr'>

                      <legend id='0Glvr'><style id='0Glvr'><dir id='0Glvr'><q id='0Glvr'></q></dir></style></legend>
                      <i id='0Glvr'><tr id='0Glvr'><dt id='0Glvr'><q id='0Glvr'><span id='0Glvr'><b id='0Glvr'><form id='0Glvr'><ins id='0Glvr'></ins><ul id='0Glvr'></ul><sub id='0Glvr'></sub></form><legend id='0Glvr'></legend><bdo id='0Glvr'><pre id='0Glvr'><center id='0Glvr'></center></pre></bdo></b><th id='0Glvr'></th></span></q></dt></tr></i><div id='0Glvr'><tfoot id='0Glvr'></tfoot><dl id='0Glvr'><fieldset id='0Glvr'></fieldset></dl></div>