michdraft
michdraft

Reputation: 556

how to change look and feel of JasperViewer?

I use JasperViewer to display my report but the look and feel is not i want.

Is there a way to change the look and feel of the 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);

Upvotes: 1

Views: 1248

Answers (1)

michdraft
michdraft

Reputation: 556

Just before staring of JasperViewer change the look and feel as below.

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();
        }

Upvotes: 5

Related Questions