*/
public static class VersionInfo {
public static final String NAME = "MIDI Chord Helper";
- public static final String VERSION = "Ver.20170930.1";
- public static final String COPYRIGHT = "Copyright (C) 2004-2017";
+ public static final String VERSION = "Ver.20180108.1";
+ public static final String COPYRIGHT = "Copyright (C) 2004-2018";
public static final String AUTHER = "@きよし - Akiyoshi Kamide";
public static final String URL = "http://www.yk.rim.or.jp/~kamide/music/chordhelper/";
}
* @return 選択されたMIDIシーケンスのテーブルモデル(非選択時はnull)
*/
private SequenceTrackListTableModel getSelectedSequenceModel() {
- if( selectionModel.isSelectionEmpty() ) return null;
- int selectedIndex = selectionModel.getMinSelectionIndex();
+ int i = getSelectedRow();
+ if( i < 0 ) return null;
List<SequenceTrackListTableModel> list = getModel().getSequenceModelList();
- return selectedIndex >= list.size() ? null : list.get(selectedIndex);
+ return i >= list.size() ? null : list.get(i);
}
/**
* 行が選択されているときだけイネーブルになるアクション
setEnebledBySelection();
}
protected void setEnebledBySelection() {
- int index = selectionModel.getMinSelectionIndex();
- setEnabled(index >= 0);
+ setEnabled(getSelectedRow() >= 0);
}
private void init(String tooltip) {
putValue(Action.SHORT_DESCRIPTION, tooltip);
"選択したMIDIシーケンスはまだ保存されていません。プレイリストから削除しますか?";
@Override
public void actionPerformed(ActionEvent event) {
+ int index = getSelectedRow();
+ if( index < 0 ) return;
PlaylistTableModel model = getModel();
+ List<SequenceTrackListTableModel> list = model.getSequenceModelList();
+ if( index >= list.size() ) return;
+ SequenceTrackListTableModel sequenceModel = list.get(index);
+ if( sequenceModel == null ) return;
if( midiFileChooser != null ) {
- SequenceTrackListTableModel sequenceModel = getSelectedSequenceModel();
- if( sequenceModel != null && sequenceModel.isModified() && JOptionPane.showConfirmDialog(
+ if( sequenceModel.isModified() && JOptionPane.showConfirmDialog(
((JComponent)event.getSource()).getRootPane(),
CONFIRM_MESSAGE,
ChordHelperApplet.VersionInfo.NAME,
JOptionPane.WARNING_MESSAGE) != JOptionPane.YES_OPTION
) return;
}
- if( ! selectionModel.isSelectionEmpty() ) try {
- model.remove(selectionModel.getMinSelectionIndex());
+ try {
+ model.remove(index);
} catch (Exception ex) {
JOptionPane.showMessageDialog(
((JComponent)event.getSource()).getRootPane(), ex,
if( column != null && ! column.isChanged(event) ) return false;
SequenceTrackListTableModel loadedSequence = sequencerModel.getSequenceTrackListTableModel();
return loadedSequence != null && IntStream.rangeClosed(event.getFirstRow(), event.getLastRow())
- .anyMatch( index -> index != TableModelEvent.HEADER_ROW && sequenceModelList.get(index) == loadedSequence );
+ .anyMatch( i -> i >= 0 && i < sequenceModelList.size() && sequenceModelList.get(i) == loadedSequence );
}
/**
* [row, column]にあるセルの値が更新されたことを、すべてのリスナーに通知します。