我在JBUILDER下开发了一个应用程序,采用的是CARDLAYOUT,在每一层中都有一个JSROLLPANE,然后再放一个JTABLE,然后从数据库中读取数据,放入不同的JTABLE中,有需求要讲JTABLE中的数据打印出来,而且只打印当前可见的那层表格中的记录.有的表格中的数据很多,要实现分页打印。我目前的解决方案是在每层中加入一个JBUTTON,然后写事件处理代码来实现打印功能,将整个JSROLLPANE控件作为图片打印出来。可是不能分页,而且页面太大,不能打完整。请高手指教,有没有其他的解决方案注:我现在身边没有参考书,最好能给我代码
public boolean print()
throws PrinterException
A convenience method that displays a printing dialog, and then prints this JTable in mode PrintMode.FIT_WIDTH, with no header or footer text. A modal progress dialog, with an abort option, will be shown for the duration of printing.
Note: In headless mode, no dialogs will be shown.
Returns:
true, unless printing is cancelled by the user
Throws:
PrinterException - if an error in the print system causes the job to be aborted
http://www.finereport.com