deklotz Posted September 9, 2006 Share Posted September 9, 2006 Greetings, First I wish to say that I have been using the Jasper Report library for almost two years and I have offered my support by buying two copies of the Ultimate Guide. Excellent work in both area if I may say so. Just recently I have run into a snag with the JRViewer class. I ended up using the class as it stands within my applet classes and for a long time, I have had no problems with it. This even with the warning from the developer that the class is offered as an example. The bug I've come across is related to the following: 1) Using mozilla/firefox engine2) Windows XP SP2, Java 1.5 latest3) Applet using Jasper 1.2.5 (I also tried the latest too)4) Run the browser with applet and everything looks and is running fine.5) Resize the browser main window and after a couple of passes within the JRViewer's inner classes paintComponent (The extended JLabel for the main report body) - the browser and java lockup! The lockup only occurs within the firefox/mozilla engine. Internet Explorer works just fine. After a lot of hair pulling I've figured out that the JRViewer inner class is needlessly creating a JRExporter object every time the inner classes paintComponent is called. I've moved the creation of the object outside to one of the main JRViewer class intialization methods and so far so good. My quesiton to the world :) is whether there are any reasons not to do this and if anyone has run across this problem before? Any and all advice is greatly appreciated. -Dennis Klotz Link to comment Share on other sites More sharing options...
deklotz Posted September 11, 2006 Author Share Posted September 11, 2006 Hello. Does anyone have a problem with the following changes to JRViewer? Code:$ diff -c src/net/sf/jasperreports/view/JRViewer.java ../jasperreports-1.2.5-project/src/net/sf/jasperreports/view/JRViewer.java*** src/net/sf/jasperreports/view/JRViewer.java Fri Sep 8 17:23:51 2006--- ../jasperreports-1.2.5-project/src/net/sf/jasperreports/view/JRViewer.java Mon Jul 3 14:49:08 2006****************** 65,71 **** import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.JViewport;- import javax.swing.SwingUtilities; import javax.swing.filechooser.FileFilter; import net.sf.jasperreports.engine.JRException;--- 65,70 ----****************** 347,361 **** { this.resourceBundle = resBundle; }-- try- {- exporter = new JRGraphics2DExporter();- }- catch (Exception e)- {- e.printStackTrace ();- }}--- 346,351 ----****************** 1590,1595 ****--- 1580,1586 ---- { try {+ JRGraphics2DExporter exporter = new JRGraphics2DExporter(); exporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint); exporter.setParameter(JRGraphics2DExporterParameter.GRAPHICS_2D, grx); exporter.setParameter(JRExporterParameter.PAGE_INDEX, new Integer(pageIndex));****************** 1620,1634 **** public void paintComponent(Graphics g) {! synchronized (viewer)! {! viewer.paintPage((Graphics2D)g.create());! } } }!! private JRGraphics2DExporter exporter ;! // Variables declaration - do not modify//GEN-BEGIN:variables protected javax.swing.JToggleButton btnActualSize;--- 1611,1620 ---- public void paintComponent(Graphics g) {! viewer.paintPage((Graphics2D)g.create()); }}! // Variables declaration - do not modify//GEN-BEGIN:variables protected javax.swing.JToggleButton btnActualSize; I did this against 1.2.5, if there is interest I would be happy to do this against 1.2.6. Thanks. -Dennis [file name=PatchContents size=723]http://www.jasperforge.org/components/com_joomlaboard/uploaded/files/jasper1.txt[/file]Post edited by: deklotz, at: 2006/09/11 19:57 Link to comment Share on other sites More sharing options...
deklotz Posted September 11, 2006 Author Share Posted September 11, 2006 // duplicate Post edited by: deklotz, at: 2006/09/11 19:52 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now