简体   繁体   English

如何改变JasperViewer的外观?

[英]how to change look and feel of JasperViewer?

I use JasperViewer to display my report but the look and feel is not i want. 我使用JasperViewer来显示我的报告,但是外观和感觉不是我想要的。

Is there a way to change the look and feel of the JasperViewer? 有没有办法改变JasperViewer的外观?

For example if you click on save button i want to have look and feel of windows or the same things for print dialog when clicking on the print button. 例如,如果您单击“保存”按钮,则我希望在单击“打印”按钮时具有窗口的外观或与打印对话框相同的外观。

JasperViewer viewer = new JasperViewer(mainPrint,false); 
//viewer.changeLookAndFeel();
viewer.setVisible(true);

Just before staring of JasperViewer change the look and feel as below. 刚注视JasperViewer之前,请更改外观,如下所示。

try {
            UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
            JasperViewer viewer = new JasperViewer(mainPrint,false); 
            viewer.setVisible(true);
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        } catch (InstantiationException e) {
            e.printStackTrace();
        } catch (IllegalAccessException e) {
            e.printStackTrace();
        } catch (UnsupportedLookAndFeelException e) {
            e.printStackTrace();
        }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM