TutorialExample.java

/*
 * TutorialExample.java
 *
 * Copyright (C) 2004-05 Side of Software (SOS)
 * All rights reserved.
 *
 *    http://www.sideofsoftware.com
 *    info@sideofsoftware.com
 */

package sos.examples;

import javax.swing.*;
import sos.reports.*;

/**
 * A sample application that displays a report with no special formatting.<p>
 *
 * @author  Side of Software
 */
public class TutorialExample
{
  public static void main(String[] args)
  {
    SwingUtilities.invokeLater( new Runnable() {
      public void run()
      {
        Object[][] data = new Object[][] {
          { "Family", "1850 Census", "1860 Census", "1870 Census", "Notes" },
          { "Smith", Boolean.TRUE, Boolean.FALSE, Boolean.FALSE, "" },
          { "Johnson", Boolean.FALSE, Boolean.TRUE, Boolean.TRUE, "In 1860 spelled Johnssen" },
          { "Russell", Boolean.TRUE, Boolean.TRUE, Boolean.TRUE, "" },
          { "Grant", Boolean.FALSE, Boolean.FALSE, Boolean.FALSE, "Not found in Springfield" },
          { "Baker", Boolean.TRUE, Boolean.FALSE, Boolean.TRUE, "" },
        };

        TableReportTemplate template = new TableReportTemplate( "Census Template", 1, 1, 0, 0 );
        Report report = template.createReport( data );

        JReportPane reportPane = new JReportPane( report );
        JScrollPane scrollPane = new JScrollPane( reportPane );
        JFrame frame = new JFrame( "Census Report" );
        frame.getContentPane().add( scrollPane );
        frame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
        frame.setSize( 500, 300 );
        frame.show();
      }
    } );
  } 
}