protected TGChordImpl getChord(int x, int y, boolean setAsSelected) { for (TGChord graphicChord : this.graphicChords) { TGChordImpl chord = (TGChordImpl) graphicChord; int x1 = chord.getPosX(); int x2 = x1 + chord.getWidth(); int y1 = chord.getPosY(); int y2 = y1 + chord.getHeight(); if (x > x1 && x < x2 && y > y1 && y < y2) { if (setAsSelected) { if (this.selectedChord != null) { this.selectedChord.dispose(); } this.selectedChord = chord; chord.dispose(); } return chord; } } return null; }
public void disposeChords() { for (TGChord graphicChord : this.graphicChords) { ((TGChordImpl) graphicChord).dispose(); } this.graphicChords.clear(); }