예제 #1
0
  /** Loads the icons for the tile patterns list. */
  private void loadIcons() {

    tilePatternIcons.clear();

    for (TilePattern tilePattern : tileset.getTilePatterns()) {
      tilePatternIcons.add(new TilePatternIcon(tilePattern, tileset));
    }
  }
예제 #2
0
  /**
   * Sets the tileset observed.
   *
   * @param tileset the current tileset, or null if there is no tileset
   */
  public void setTileset(Tileset tileset) {

    if (tileset != this.tileset) {

      if (this.tileset != null) {
        this.tileset.deleteObserver(tilePatternsListModel);
      }

      this.tileset = tileset;
      tilesetPropertiesView.setTileset(tileset);
      tilePatternView.setTileset(tileset);

      if (tileset != null) {
        tileset.addObserver(tilePatternsListModel);

        loadIcons();
        tilePatternsListModel.update(tileset, null);
      } else {
        repaint();
      }
    }
  }