| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 736 人关注过本帖
标题:J2SE怎么打印JTABLE?
只看楼主 加入收藏
b1angel
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2010-8-12
结帖率:0
收藏
已结贴  问题点数:20 回复次数:3 
J2SE怎么打印JTABLE?
如题啊。。。
try
            {
                        Toolkit   kit   =   Toolkit.getDefaultToolkit();   
                                                                      //获取工具箱
                                                          Properties   props   =   new   Properties();
                                                            
                                                            props.setProperty( "awt.print.printer ", "Epson5000 ");
                                                            props.setProperty( "awt.print.numCopies ", "1 ");
                                                            
                                                            if   (kit   !=   null)   {
                                                            //获取工具箱自带的打印对象
                                                            PrintJob   printJob   =   kit.getPrintJob(this,   "打印查询结果 ",   props);
                                                            if   (printJob   !=   null)   {
                                                            Graphics   pg   =   printJob.getGraphics();   //获取打印对象的图形环境
                                                          if   (pg   !=   null)   
                                                          {
                                                            try   
                                                          {
                                                                    jp1.printAll(pg);   
                                                                    this.repaint();
                    
                                                          }catch(Exception   e)
                                                          {
                                                          }
                                                            }
                                                            }           
                                                          }
这个我尝试过,但是好像连接有问题
搜索更多相关主题的帖子: JTABLE 打印 
2010-08-12 11:29
b1angel
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2010-8-12
收藏
得分:0 
在线等,急!!
2010-08-12 11:33
shellingford
Rank: 9Rank: 9Rank: 9
等 级:贵宾
威 望:19
帖 子:228
专家分:1348
注 册:2010-8-9
收藏
得分:10 
不明白什么意思,代码中没有jtable额
2010-08-12 12:28
快速回复:J2SE怎么打印JTABLE?
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.074336 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved