I am customizing an App for personal use. This App can make many midi files in Java.
i want to change to "getSelectedValuesList()” from "getMinSelectionIndex();” in this code
Because I want to choose and SAVE many files in one time from list. I already could select many files in one time.
(I already changed below)
public interface ListSelectionModel
{
int MULTIPLE_INTERVAL_SELECTION = 2;
}
(Error message)
getSelectedValuesList() is not defined in ListSelectionModel
I changed a chord like this. But it is error.
.getMinSelectionIndex();
=> .getSelectedValuesList();
(Original cord)
/**
* To send a selected table model, that is MIDI sequence.
* @return => selected MIDI sequence table model. (If we don’t choose, it is null)
*/
public SequenceTrackListTableModel getSelectedSequenceModel() {
if( sequenceListSelectionModel.isSelectionEmpty() ) return null;
int selectedIndex = sequenceListSelectionModel.getMinSelectionIndex();
if( selectedIndex >= sequenceList.size() ) return null;
return sequenceList.get(selectedIndex);
}
(My Idea)
/**
* To send a selected table model, that is MIDI sequence.
* @return => selected MIDI sequence table model. (If we don’t choose, it is null)
*/
public SequenceTrackListTableModel getSelectedSequenceModel() {
if( sequenceListSelectionModel.isSelectionEmpty() ) return null;
int selectedIndex = sequenceListSelectionModel.getSelectedValuesList();
if( selectedIndex >= sequenceList.size() ) return null;
return sequenceList.get(selectedIndex);
}
class MyListSelectionModel extends DefaultListSelectionModel{
public returntypeoftheExistinggetMinSelectionIndex getSelectedValuesList(){
return getMinSelectionIndex();
}
}
And while creating the sequenceListSelectionModel object use the new class like
public ListSelectionModel sequenceListSelectionModel = new MyListSelectionModel ()