I have a button to print iReport but it take time to display the report so I made a loading frame class called Loading
and I am trying to call this class when I         
        
Create New Undecorated frame with loading giffy or loading name.as LoadingScreen.
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {                        
            LoadingScreen ls=new LoadingScreen();
     ls.setVisible(true);// show frame before trying to connect to database and load report
    try {
        String reportquery = "Select * from invoices ";
        JasperDesign jasperdesign = JRXmlLoader.load("StatementReport.jrxml");
        JRDesignQuery designquery = new JRDesignQuery();
        designquery.setText(reportquery);
        jasperdesign.setQuery(designquery);
        JasperReport jasperreport = JasperCompileManager.compileReport(jasperdesign);
        JasperPrint jasperprint = JasperFillManager.fillReport(jasperreport, null, con);
     ls.dispose();
        JasperViewer.viewReport(jasperprint, false);
    } catch (JRException e) {
        JOptionPane.showMessageDialog(this, e);
    } finally {
        try {
            rs.close();
            pst.close();
        } catch (SQLException ex) {
            Logger.getLogger(showAllInvoices.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
}  
I hope this will run