// ImageResourceListener public void animatedTileAdded(ImageResource source, AnimatedTile tile) { if (tile.getWidth() == AnimatedTileList.this.editorComponent.getTiledLayer().getTileWidth() && tile.getHeight() == AnimatedTileList.this.editorComponent.getTiledLayer().getTileHeight()) { this.addElement(tile); tile.addSequenceContainerListener(this); } }
private void init() { List animatedTiles = this.imageResource.getAnimatedTiles( this.editorComponent.getTiledLayer().getTileWidth(), this.editorComponent.getTiledLayer().getTileHeight()); for (Iterator iter = animatedTiles.iterator(); iter.hasNext(); ) { AnimatedTile tile = (AnimatedTile) iter.next(); tile.addSequenceContainerListener(this.model); this.model.addElement(tile); } }
private void handlePopup(MouseEvent e) { JPopupMenu menu = new JPopupMenu(); int row = AnimatedTileList.this.locationToIndex(e.getPoint()); if (row == -1) { // clicked on empty area return; } setSelectedIndex(row); AnimatedTile at = (AnimatedTile) AnimatedTileList.this.getModel().getElementAt(row); List<Action> actions = at.getActions(); for (Action action : actions) { menu.add(action); } menu.show(this, e.getX(), e.getY()); }
public void animatedTileRemoved(ImageResource source, AnimatedTile tile) { tile.removeSequenceContainerListener(this); this.removeElement(tile); }
@Override public void addElement(Object obj) { AnimatedTile tile = (AnimatedTile) obj; super.addElement(tile); tile.addPropertyChangeListener(this); }