我想在Report
上显示JFrame
而不使用show()
方法。
我不想拥有此弹出框架,我只想在JFrame
上看到它。
目前的情况如下:
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
JasperReportBuilder jrb = new JasperReportBuilder();
int iFontsizeStringI = (Integer) jSpinner1.getValue();
int iFontsizeStringII= (Integer) jSpinner2.getValue();
String sPageSize =(String)jComboBox1.getSelectedItem();
String sPageOrientation = (String)jComboBox2.getSelectedItem();
String one = jTextField1.getText();
String two = jTextField2.getText();
FontBuilder fontI = stl.font("Courier New", true, false, iFontsizeStringI);
FontBuilder fontII = stl.font("Courier New", true, false, iFontsizeStringII);
if(sPageOrientation.equalsIgnoreCase("Landscape") && sPageSize.equalsIgnoreCase("A4"))
jrb.setPageFormat(PageType.A4, PageOrientation.LANDSCAPE);
if(sPageOrientation.equalsIgnoreCase("Landscape") && sPageSize.equalsIgnoreCase("A3"))
jrb.setPageFormat(PageType.A3, PageOrientation.LANDSCAPE);
if(sPageOrientation.equalsIgnoreCase("Portrait") && sPageSize.equalsIgnoreCase("A3"))
jrb.setPageFormat(PageType.A3, PageOrientation.PORTRAIT);
jrb.title(cmp.verticalList(cmp.text(one).setStyle(stl.style().setBorder(stl.penDouble()).setFont(fontI)
.setHorizontalAlignment(HorizontalAlignment.CENTER)),cmp.text(two).setStyle(stl.style()
.setFont(fontII).setHorizontalAlignment(HorizontalAlignment.CENTER).setBorder(stl.penDouble()))));
try {
jrb.show(false);
} catch (DRException ex) {
Exceptions.printStackTrace(ex);
}
}
我需要更改哪些内容才能让我在JFrame
中显示此内容?什么时候没有任何jrxml
文件?
答案 0 :(得分:0)
JFrame frame = new JFrame("Report");
frame.getContentPane().add(new JRViewer(jrb.toJasperPrint()));
frame.pack();
frame.setVisible(true);