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

        <small id='MA7OP'></small><noframes id='MA7OP'>

        <tfoot id='MA7OP'></tfoot>
      1. <legend id='MA7OP'><style id='MA7OP'><dir id='MA7OP'><q id='MA7OP'></q></dir></style></legend>

        获取 JTable 以打印表格格式

        Get JTable to print tabular format(获取 JTable 以打印表格格式)

          <tbody id='EmHrz'></tbody>

            <tfoot id='EmHrz'></tfoot>

            <small id='EmHrz'></small><noframes id='EmHrz'>

              <legend id='EmHrz'><style id='EmHrz'><dir id='EmHrz'><q id='EmHrz'></q></dir></style></legend>

                • <bdo id='EmHrz'></bdo><ul id='EmHrz'></ul>
                  <i id='EmHrz'><tr id='EmHrz'><dt id='EmHrz'><q id='EmHrz'><span id='EmHrz'><b id='EmHrz'><form id='EmHrz'><ins id='EmHrz'></ins><ul id='EmHrz'></ul><sub id='EmHrz'></sub></form><legend id='EmHrz'></legend><bdo id='EmHrz'><pre id='EmHrz'><center id='EmHrz'></center></pre></bdo></b><th id='EmHrz'></th></span></q></dt></tr></i><div id='EmHrz'><tfoot id='EmHrz'></tfoot><dl id='EmHrz'><fieldset id='EmHrz'></fieldset></dl></div>
                • 本文介绍了获取 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 以打印表格格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Lucene Porter Stemmer not public(Lucene Porter Stemmer 未公开)
                  How to index pdf, ppt, xl files in lucene (java based or python or php any of these is fine)?(如何在 lucene 中索引 pdf、ppt、xl 文件(基于 java 或 python 或 php 中的任何一个都可以)?)
                  KeywordAnalyzer and LowerCaseFilter/LowerCaseTokenizer(KeywordAnalyzer 和 LowerCaseFilter/LowerCaseTokenizer)
                  How to search between dates (Hibernate Search)?(如何在日期之间搜索(休眠搜索)?)
                  How to get positions from a document term vector in Lucene?(如何从 Lucene 中的文档术语向量中获取位置?)
                  Java Lucene 4.5 how to search by case insensitive(Java Lucene 4.5如何按不区分大小写进行搜索)
                    • <bdo id='K5t1N'></bdo><ul id='K5t1N'></ul>

                          <legend id='K5t1N'><style id='K5t1N'><dir id='K5t1N'><q id='K5t1N'></q></dir></style></legend>

                          <small id='K5t1N'></small><noframes id='K5t1N'>

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