tileSelectionListeners = new EventListenerList();
tileSelectionListeners = new LinkedList();
    public TilePalettePanel() {        tileSelectionListeners = new EventListenerList();        MouseInputAdapter mouseInputAdapter = new MouseInputAdapter() {            private Point origin;            public void mousePressed(MouseEvent e) {                origin = getTileCoordinates(e.getX(), e.getY());                setSelection(new Rectangle(origin.x, origin.y, 0, 0));                Tile clickedTile = getTileAt(origin.x, origin.y);                if (clickedTile != null) {                    fireTileSelectionEvent(clickedTile);                }            }            public void mouseDragged(MouseEvent e) {                Point point = getTileCoordinates(e.getX(), e.getY());                Rectangle select = new Rectangle(origin.x, origin.y, 0, 0);                select.add(point);                if (!select.equals(selection)) {                    setSelection(select);                }                fireTileRegionSelectionEvent(selection);            }        };        addMouseListener(mouseInputAdapter);        addMouseMotionListener(mouseInputAdapter);    }