swing程序中如何响应JasperViewer关闭事件?

http://ajava.org/hot/print/16569.html

http://www.techienuggets.com/Comments?tx=25302

62547 2008-02-18 14:44:11.0 Can you try
JasperViewer jrviewer = new JasperViewer(jasperPrint, false);
instead of
JasperViewer jrviewer = new JasperViewer(jasperPrint);
and see if it works?

http://jasperreports.sourceforge.net/api/net/sf/jasperreports/view/JasperViewer.html#JasperViewer(net.sf.jasperreports.engine.JasperPrint,%20boolean)

regards,
karthik

Jacques Nogueira dos Santos wrote:
>
>
>
> Hello, I´m having a problem with jrviewer.
>
> I have a form that let´s the user inform the values for the report. On
> the action of the button has the following code:
>
>
>
> .
>
> .
>
> .
>
> JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport,
> map,con);
>
> JasperViewer jrviewer = new JasperViewer(jasperPrint);
>
> jrviewer.setDefaultCloseOperation( DISPOSE_ON_CLOSE );
>
> jrviewer.setVisible(true);
>
>
>
>
>
> When I click on 'X' of the jrviewer, it´s close all the project. So I
> used the DEBUG and on Local Variables/ jrviewer, the isExitClose has
> value TRUE.
>
>
>
>
>
> What´s happening? What must I do so as to solve this problem? I want
> the jrviwer just dispose on close, and the first Form continue
> visible, not closing all the project.
>
>
>
>
>
> Thanks.
>
97118 2008-05-11 23:13:14.0 You should call JasperViewer instance with following code.
JasperViewer jasperViewer = new JasperViewer(jasperPrint, false);

Because:
============================================
public JasperViewer(JasperPrint jasperPrint){
this(jasperPrint, true);
}

public JasperViewer(JasperPrint jasperPrint, boolean isExitOnClose){
this(jasperPrint, isExitOnClose, null);
}
============================================

JasperViewer(JasperPrint jasperPrint) constructor calls JasperViewer with exit on close.

184780 2008-11-24 20:45:36.0 Thankyou so much karthik,
I saw your codes its working so fine and fulfilled my requirement.

regards,
Rohit.

posted @   qiang.xu  阅读(821)  评论(0编辑  收藏  举报
编辑推荐:
· 如何编写易于单元测试的代码
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
阅读排行:
· 周边上新:园子的第一款马克杯温暖上架
· Open-Sora 2.0 重磅开源!
· 分享 3 个 .NET 开源的文件压缩处理库,助力快速实现文件压缩解压功能!
· Ollama——大语言模型本地部署的极速利器
· DeepSeek如何颠覆传统软件测试?测试工程师会被淘汰吗?
点击右上角即可分享
微信分享提示