Cloud
Cloud-Dienstleistung für schnelle und effektive Analyse und Visualisierung von Daten für Ihr Business ohne eigene Applikationen zu erstellen oder zu programmieren.
JFrame and set the necessary options:public static void main(final String[] args) {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
try {
JFrame frame = new JFrame();
frame.add(new Printing(frame));
frame.setSize(FRAME_SIZE);
frame.setLocationRelativeTo(null);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setVisible(true);
} catch (Throwable e) {
StiExceptionProvider.show(e, null);
}
}
});
}JButton button = new JButton("Print");
leftPanel.add(button);
button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
StiReport report = getReport();
PrinterJob printerJob = StiPrintHelper.preparePrinterJob(report.getRenderedPages());
try {
StiPrintHelper.printJob(printerJob, report, true);
} catch (PrinterException pe) {
StiExceptionProvider.show(pe, null);
}
}
});final JComboBox printerList = new JComboBox(PrintServiceLookup.lookupPrintServices(null, null));
rightPanel.add(printerList);
printerList.setSelectedIndex(0);
button = new JButton("Print");
rightPanel.add(button);
button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
StiReport report = getReport();
PrinterJob printerJob = StiPrintHelper.preparePrinterJob(report.getRenderedPages());
try {
AttributeSet attr_set = new HashAttributeSet();
PrintService printService = (PrintService) printerList.getSelectedItem();
attr_set.add(new PrinterName(printService.getName(), null));
PrintService[] services = PrintServiceLookup.lookupPrintServices(null, attr_set);
printerJob.setPrintService(services[0]);
StiPrintHelper.printJob(printerJob, report);
} catch (Exception e1) {
StiExceptionProvider.show(e1, parentFrame);
}
}
});private StiReport getReport() {
if (report == null) {
try {
String demoDir = "Data/";
StiXmlDatabase xmlDatabase = new StiXmlDatabase("Demo", demoDir + "Demo.xsd", demoDir + "Demo.xml");
StiReport renderReport = StiSerializeManager.deserializeReport(new File("Reports/SimpleList.mrt"));
renderReport.getDictionary().getDatabases().add(xmlDatabase);
renderReport.setCalculationMode(StiCalculationMode.Interpretation);
renderReport.Render(false);
report = renderReport;
} catch (Exception e) {
StiExceptionProvider.show(e, null);
}
}
return report;
}