Main

To complete the system, we'll create a main() routine:

public class Main {
    public static void main(String[] args) {
        if (args.length == 0) {
            System.err.println(
                  "Arg—file w/tab-delimited author/title/year");
              System.exit(1);
          }

          Searcher searcher = null;
          try  {
              searcher = SearcherFactory.get(args[0]);
          } catch (Exception ex) {
              System.err.println(
                  "Unable to open file " + args[0] + "; " + ex);
              System.exit(1);
          }

          SearchPanel sp = new SearchPanel();
          sp.setSearcher(searcher);

          JFrame display = new JFrame("Bibliographic System—"
                                      + args[0]);
          display.getContentPane().add(sp);
          display.setSize(500,500);
          display.setVisible(true);
      }
   }

Get Extreme Programming Installed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.