PDA

View Full Version : How to create a report in a jpanel ?



Anonymous
04-01-2002, 05:32 PM
Hi
I've managed to create a report into a PreviewFrame, but I want to put a report into a JSplitPane i've got.

How do you send the report into a JPanel ???

thanks
jim

Anonymous
04-02-2002, 01:45 PM
I created my own panel with buttons to display. But basically, the idea I got from looking at PreviewFrame is that you need to create a ReportPane which requires a G2OutputTarget and a PageFormat. Then add the pane to your panel. The following is an example:

// add report
PrinterJob pj = PrinterJob.getPrinterJob();
PageFormat pf = pj.defaultPage();
pf = pj.validatePage(pf);
reportPane = new ReportPane(report, new G2OutputTarget(null, pf));
reportPane.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
JScrollPane scroll = new JScrollPane(reportPane);
add(scroll, BorderLayout.CENTER);


Steve