取JasperReport中图形对象可用key
long start = System.currentTimeMillis();
File sourceFile = new File("build/reports/AlterDesignReport.jasper");
System.err.println(" : " + sourceFile.getAbsolutePath());
JasperReport jasperReport = (JasperReport)JRLoader.loadObject(sourceFile);
JRRectangle rectangle = (JRRectangle)jasperReport.getTitle().getElementByKey("first.rectangle");
rectangle.setForecolor(new Color((int)(16000000 * Math.random())));
rectangle.setBackcolor(new Color((int)(16000000 * Math.random())));
rectangle = (JRRectangle)jasperReport.getTitle().getElementByKey("second.rectangle");
rectangle.setForecolor(new Color((int)(16000000 * Math.random())));
rectangle.setBackcolor(new Color((int)(16000000 * Math.random())));
rectangle = (JRRectangle)jasperReport.getTitle().getElementByKey("third.rectangle");
rectangle.setForecolor(new Color((int)(16000000 * Math.random())));
rectangle.setBackcolor(new Color((int)(16000000 * Math.random())));
JRStyle style = jasperReport.getStyles()[0];
style.setFontSize(16f);
style.setItalic(true);
JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport, null, (JRDataSource)null);
File destFile = new File(sourceFile.getParent(), jasperReport.getName() + ".jrprint");
JRSaver.saveObject(jasperPrint, destFile);
System.err.println("Filling time : " + (System.currentTimeMillis() - start));