Exemplo n.º 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());
  }
Exemplo n.º 2
0
 /**
  * Determine if the item is above on of the drawers.
  *
  * @param item the item to check
  * @return <b>true</b> if the item is above on of the drawers and <b>false</b> otherwise
  * @see Drawer#isItemAbove(Zone)
  */
 public static boolean isItemAboveDrawer(MoveableItem item) {
   if (leftDrawer != null && leftDrawer.isItemAbove(item)) return true;
   else if (rightDrawer != null && rightDrawer.isItemAbove(item)) return true;
   else if (topDrawer != null && topDrawer.isItemAbove(item)) return true;
   else return false;
 }