在线求助 JTable分页打印的例子,来者有分! JDK5.0已经支持JTable打印功能了,哪位gggjj能够给我一个JTable分页打印的例子呢,谢先了! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 我的一个完整的例子:public void PrintModel(Object print_object){ int[] range = {1,100}; int[][] pageranges = {range}; JobAttributes job_att = new JobAttributes(1,JobAttributes.DefaultSelectionType.ALL, JobAttributes.DestinationType.PRINTER,JobAttributes.DialogType.COMMON, "重命名",100,1, JobAttributes.MultipleDocumentHandlingType.SEPARATE_DOCUMENTS_COLLATED_COPIES, pageranges,"Adobe PDF",JobAttributes.SidesType.TWO_SIDED_LONG_EDGE); PageAttributes page_att = new PageAttributes(); PrintJob printjob = this.getToolkit().getPrintJob((PlanMainFrm)ownerFrame, "ok", job_att,page_att); if(printjob == null) return; if(print_object instanceof V_FileDescriptor){ V_FileDescriptor filedesc = (V_FileDescriptor) print_object; int model_index = 0; while(model_index < filedesc.model_vect.size()){ M_Model print_model = (M_Model) filedesc.model_vect.get(model_index); JDrawPane drawpane = print_model.modelpane.DrawPane; job_att.setFileName(print_model.m_name); Graphics graph = printjob.getGraphics(); graph.setFont(new Font("宋体",Font.PLAIN,12)); SA_GraphRender.PrintUnits(drawpane, graph); graph.dispose(); model_index++; } } if(print_object instanceof M_Model){ M_Model print_model = (M_Model) print_object; JDrawPane drawpane = print_model.modelpane.DrawPane; job_att.setFileName(print_model.m_name); Graphics graph = printjob.getGraphics(); graph.setFont(new Font("宋体",Font.PLAIN,12)); SA_GraphRender.PrintUnits(drawpane, graph); graph.dispose(); } printjob.end(); }你自己找你要的东西吧,我去吃饭了,8 to:littlesia(),直接打印图形的我会,我要的是利用JDK1.5新增JTable的打印功能555555,偌大一个CSDN就没有人来解决我这个问题了???? JDK1.5里面的SwingSet2演示程序里就有啊, 而且是可以分页的 JDK1.5里面的SwingSet2演示程序里就有啊, 而且是可以分页的 楼主,你的jtable分页问题解决了吗?SwingSet2里面哪个类是实现分页的啊 ? 面试题:关于String 大专毕业生的工作疑惑 关于java 学生管理系统里面有段代码看不懂(XML起什么作用等问题) 一个数据库查询问题,在线等待!急!!! 用java程序怎么判断rar文档加密状态? 帮我看看这程序错在哪里 怎么统计一个目录下的所有文件行数 程序运行错误,帮我看看 JTextField问题,如何把由左向右输入改为由右向左输入! 一个关于awt和swing组件混用的Focus问题 Microsoft][SQLServer 2000 Driver for JDBC]Error establishing socket.
public void PrintModel(Object print_object){
int[] range = {1,100};
int[][] pageranges = {range};
JobAttributes job_att = new JobAttributes(1,JobAttributes.DefaultSelectionType.ALL,
JobAttributes.DestinationType.PRINTER,JobAttributes.DialogType.COMMON, "重命名",100,1,
JobAttributes.MultipleDocumentHandlingType.SEPARATE_DOCUMENTS_COLLATED_COPIES,
pageranges,"Adobe PDF",JobAttributes.SidesType.TWO_SIDED_LONG_EDGE);
PageAttributes page_att = new PageAttributes();
PrintJob printjob = this.getToolkit().getPrintJob((PlanMainFrm)ownerFrame, "ok", job_att,page_att);
if(printjob == null)
return;
if(print_object instanceof V_FileDescriptor){
V_FileDescriptor filedesc = (V_FileDescriptor) print_object;
int model_index = 0;
while(model_index < filedesc.model_vect.size()){
M_Model print_model = (M_Model) filedesc.model_vect.get(model_index);
JDrawPane drawpane = print_model.modelpane.DrawPane;
job_att.setFileName(print_model.m_name);
Graphics graph = printjob.getGraphics();
graph.setFont(new Font("宋体",Font.PLAIN,12));
SA_GraphRender.PrintUnits(drawpane, graph);
graph.dispose();
model_index++;
}
}
if(print_object instanceof M_Model){
M_Model print_model = (M_Model) print_object;
JDrawPane drawpane = print_model.modelpane.DrawPane;
job_att.setFileName(print_model.m_name);
Graphics graph = printjob.getGraphics();
graph.setFont(new Font("宋体",Font.PLAIN,12));
SA_GraphRender.PrintUnits(drawpane, graph);
graph.dispose();
}
printjob.end();
}
你自己找你要的东西吧,我去吃饭了,8