Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8027283
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T23:45:49+00:00 2026-06-04T23:45:49+00:00

I am calling this function from a report preview form of a panel. demo

  • 0

I am calling this function from a report preview form of a panel.

demo : Main Panel – [which calls] – ReportSelectionDialog(Frame) – [which opens] Report(Frame)

the problem is that when I open the report directly from the MainPanel

demo : Main Panel – – Report(Frame)

the JasperFillManager only takes like a second to fill the report but when I do the first demo, it took JasperFillManager 20-30 seconds to fill the report. I checked on the parameters required (connection, parameter map) and they were loaded instantly upon opening ReportSelectionDialog. I need the ReportSelectionDialog but I dont want to wait so long just to open a report. Please help. Here is my code to load the report. Is there another way to fill the reports. And also is there a way to just load the .jasper file instead of compiling the report everytime?

private void openReport(){
    String reportFile = getFileName(reportList.getSelectedValue().toString());
    FileInputStream fs = null;

    try {
        fs = new FileInputStream(reportPath+reportFile);
        JasperDesign jasperDesign = JRXmlLoader.load(fs);
        JasperReport jasperReport = JasperCompileManager.compileReport(jasperDesign);
        JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport, parameters, conn);
        javax.swing.JFrame jframe = new javax.swing.JFrame();
        jframe.setIconImage(Toolkit.getDefaultToolkit().getImage(this.getClass().getResource("/timsoftware/images/timlogo.png")));
        jframe.getContentPane().add(new JRViewer(jasperPrint));
        jframe.pack();
        jframe.setExtendedState(javax.swing.JFrame.MAXIMIZED_BOTH);
        jframe.setVisible(true);
    } catch (FileNotFoundException | JRException | HeadlessException e) {
        clsErrorHandler.printError(e.toString(), panelName, "PrintRecord");
    } finally {
        try {
            fs.close();
        } catch (IOException ex) {
            Logger.getLogger(ReportPreviewForm.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
    this.dispose();
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T23:45:50+00:00Added an answer on June 4, 2026 at 11:45 pm
     JasperDesign jasperDesign = JRXmlLoader.load(fs);
     JasperReport jasperReport = JasperCompileManager.compileReport(jasperDesign);
    

    Move those lines out of the method and somewhere in your initialization sequence. May be the constructor? And it should do the trick. Problem is you are compiling the report over and over again in the method, which is not necessary. If you do it once to initialize jasperReport it’s enough.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i am calling this function from the menu and calls the upload(item) function to
I have a function which returns array and I am calling this function from
I am calling this from a function by creating an object.The progress box appears
I need this for calling a C function from Java class (JNI) and I
I am calling an R function from the R package e1071 which is interfaced
I'm calling this function from a jUnit test case with the following information: //
Hi I'm calling this function: function getCoordenadas() { var coordenadas = new Array(); $.post(
I have a function like this: MyFunction(double matrix[4][4]) {/*do stuff*/} I am calling this
This is related to a question I've asked previously: Calling Javascript function after loading
I have a function that is calling wget via subprocess.Popen. The purpose of this

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.