import java.awt.*; import java.io.*; import java.awt.event.*; import jet.bean.*; public class TestRAStreamInput extends Frame implements ActionListener { JRRunViewer beanClient = null; public TestRAStreamInput() { super("Test Bean"); setBounds(20, 20, 250, 350); setBackground(Color.lightGray); Menu m1 = new Menu("Test"); //Create a menu for test //Add the menu items to menu m1 MenuItem item = new MenuItem("start"); item.addActionListener(this); m1.add(item); MenuBar mb = new MenuBar(); mb.add(m1); setMenuBar(mb); addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { if ( beanClient != null ) beanClient.exit(); System.exit(0); } } ); show(); } public void actionPerformed(ActionEvent e) { String label = e.getActionCommand(); if ( label.equals("start") ) { beanClient = new JRRunViewer(true); beanClient.setShowInfoLevel( beanClient.vDebug | beanClient.vError ); add("Center", beanClient); // the new way of run report which use the RAStreamInput try { File f = new File("\\\\222.222.222.55\\d\\JREntServer530\\jreports\\invoice.rst"); long length = f.length(); FileInputStream fi = new FileInputStream(f); jet.ie.io.RAStreamInput raf = new jet.ie.io.RAStreamInput(fi, length); beanClient.setRandomInput(raf); beanClient.runReport(); show(); fi.close(); String sStatus = beanClient.getStatus(); System.out.println( "------Status:" + sStatus ); } catch(Exception ee) { ee.printStackTrace(); } } } public static void main(String[] args) { new TestRAStreamInput(); } }