Example #1
0
  /**
   * Load the GUI from a file.
   *
   * @see SimpleMarshaller#unmarshallGui(Application, File)
   */
  public static void loadGUI() {
    LOGGER.info("Loading GUI from file: " + Settings.dataFolder + Settings.guiFile);

    try {
      SimpleMarshaller.unmarshallGui(instance, new File(Settings.dataFolder + Settings.guiFile));
    } catch (Exception e) {
      LOGGER.fatal("Failed to load GUI. " + e.getLocalizedMessage());
      System.exit(1);
    }

    if (backgroundImage != null && backgroundImage.length() > 0) {
      bg = instance.loadImage(Settings.dataFolder + backgroundImage);
      if (bg == null)
        LOGGER.error("Failed to load image: " + Settings.dataFolder + backgroundImage);
    }

    // Create default canvas (in case it is not specified in the layout file
    setCanvas(new Canvas((instance.width - 800) / 2, (instance.height - 600) / 2, 800, 600, 255));

    // Create control buttons
    makeControlPanel(topDrawer.getContainer());
  }