Package net.sourceforge.jiu.apps

Examples of net.sourceforge.jiu.apps.EditorState


   * Creates a {@link JiuAwtFrame} object.
   * @param args program arguments, call jiuawt with <code>--help</code> as single argument to get a help screen
   */
  public static void main(String[] args)
  {
    EditorState state = new EditorState();
    int index = 0;
    while (index < args.length)
    {
      String s = args[index++];
      if ("--dir".equals(s))
      {
        if (index == args.length)
        {
          throw new IllegalArgumentException("Directory switch must be followed by a directory name.");
        }
        state.setCurrentDirectory(args[index++]);
      }
      else
      if ("--help".equals(s))
      {
        printVersion();
        System.out.println();
        System.out.println("Usage: jiuawt [OPTIONS] [FILE]");
        System.out.println("\tFILE is the name of an image file to be loaded after start-up");
        System.out.println("\t--dir  DIRECTORY  set working directory to DIRECTORY");
        System.out.println("\t--help            print this help screen and exit");
        System.out.println("\t--lang LANGCODE   set language to LANGCODE (de=German, en=English, es=Spanish)");
        System.out.println("\t--system          print system info and exit");
        System.out.println("\t--version         print version information and exit");
        System.exit(0);
      }
      else
      if ("--lang".equals(s))
      {
        if (index == args.length)
        {
          throw new IllegalArgumentException("Language switch must be followed by language code.");
        }
        state.setStrings(args[index++]);
      }
      else
      if ("--system".equals(s))
      {
        String info = SystemInfo.getSystemInfo(state.getStrings());
        System.out.println(info);
        System.exit(0);
      }
      else
      if ("--version".equals(s))
      {
        printVersion();
        System.exit(0);
      }
      else
      {
        if (s.startsWith("-"))
        {
          throw new IllegalArgumentException("Unknown switch: " + s);
        }
        else
        {
          state.setStartupImageName(s);
        }
      }
    }
    state.ensureStringsAvailable();
    new JiuAwtFrame(state);
  }
View Full Code Here

TOP

Related Classes of net.sourceforge.jiu.apps.EditorState

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.