*/
public static class VersionInfo {
public static final String NAME = "MIDI Chord Helper";
- public static final String VERSION = "Ver.20160518.1";
+ public static final String VERSION = "Ver.20160519.1";
public static final String COPYRIGHT = "Copyright (C) 2004-2016";
public static final String AUTHER = "@きよし - Akiyoshi Kamide";
public static final String URL = "http://www.yk.rim.or.jp/~kamide/music/chordhelper/";
}
};
}
- // 終了してよいか確認する
- public boolean isConfirmedToExit() {
- return ! isModified() || JOptionPane.showConfirmDialog(
- this,
- "MIDI file not saved, exit anyway ?\n保存されていないMIDIファイルがありますが、終了してよろしいですか?",
- VersionInfo.NAME,
- JOptionPane.YES_NO_OPTION,
- JOptionPane.WARNING_MESSAGE
- ) == JOptionPane.YES_OPTION ;
- }
/**
- * ã\82¢ã\83\97ã\83ªã\82±ã\83¼ã\82·ã\83§ã\83³ã\81®ã\82¢ã\82¤ã\82³ã\83³ã\82¤ã\83¡ã\83¼ã\82¸
+ * ã\82¢ã\83\97ã\83ªã\82±ã\83¼ã\82·ã\83§ã\83³ã\81®ã\82¤ã\83¡ã\83¼ã\82¸ã\82¢ã\82¤ã\82³ã\83³
*/
public ImageIcon imageIcon;
/**
+ * アプリケーションのアイコンイメージ
+ */
+ public Image iconImage;
+ /**
* ボタンの余白を詰めたいときに setMargin() の引数に指定するインセット
*/
public static final Insets ZERO_INSETS = new Insets(0,0,0,0);
URL imageIconUrl = getClass().getResource(imageIconPath);
if( imageIconUrl == null ) {
System.out.println("Icon image "+imageIconPath+" not found");
- imageIcon = null;
}
else {
imageIcon = new ImageIcon(imageIconUrl);
+ iconImage = imageIcon.getImage();
}
- Image iconImage = (imageIcon == null) ? null : imageIcon.getImage();
rootPaneDefaultBgcolor = getContentPane().getBackground();
chordMatrix = new ChordMatrix() {{
addChordMatrixListener(new ChordMatrixListener(){
import java.awt.Toolkit;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
+import java.awt.event.WindowListener;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import javax.swing.event.TableModelListener;
import camidion.chordhelper.mididevice.MidiSequencerModel;
+import camidion.chordhelper.midieditor.MidiSequenceEditor;
import camidion.chordhelper.midieditor.PlaylistTableModel;
import camidion.chordhelper.midieditor.SequenceTrackListTableModel;
}
});
}
- private static class AppletFrame extends JFrame
- implements AppletStub, AppletContext
- {
- JLabel status_;
- ChordHelperApplet applet;
+ private static class AppletFrame extends JFrame implements AppletStub, AppletContext {
+ private JLabel status_ = new JLabel("Welcome to "+ChordHelperApplet.VersionInfo.NAME) {
+ { setFont(getFont().deriveFont(Font.PLAIN)); }
+ };
+ private ChordHelperApplet applet;
+ private WindowListener windowListener = new WindowAdapter() {
+ @Override
+ public void windowClosing(WindowEvent evt) {
+ MidiSequenceEditor ed = applet.deviceModelList.getEditorDialog();
+ if( ! ed.sequenceListTable.getModel().isModified() || ed.confirm(
+ "MIDI file not saved, exit anyway ?\n"+
+ "保存されていないMIDIファイルがありますが、終了してよろしいですか?"
+ )) System.exit(0);
+ }
+ };
public AppletFrame(ChordHelperApplet applet) {
+ this.applet = applet;
setTitle(ChordHelperApplet.VersionInfo.NAME);
- (status_ = new JLabel()).setFont(
- status_.getFont().deriveFont(Font.PLAIN)
- );
- add( this.applet = applet, BorderLayout.CENTER );
+ add( applet, BorderLayout.CENTER );
add( status_, BorderLayout.SOUTH );
applet.setStub(this);
applet.init();
- Image iconImage = applet.imageIcon == null ? null : applet.imageIcon.getImage();
- setIconImage(iconImage);
+ setIconImage(applet.iconImage);
setDefaultCloseOperation( WindowConstants.DO_NOTHING_ON_CLOSE );
- addWindowListener(new WindowAdapter() {
- @Override
- public void windowClosing(WindowEvent evt) {
- if( AppletFrame.this.applet.isConfirmedToExit() )
- System.exit(0);
- }
- });
+ addWindowListener(windowListener);
new TitleUpdater(applet);
pack();
setLocationRelativeTo(null);
* タイトルバー更新器
*/
private class TitleUpdater implements ChangeListener, TableModelListener {
- MidiSequencerModel sequencerModel;
+ private MidiSequencerModel sequencerModel;
/**
* タイトルバー更新器の構築
* @param applet 対象アプレット
@Override
public void tableChanged(TableModelEvent e) {
int col = e.getColumn();
- if( col == PlaylistTableModel.Column.FILENAME.ordinal() ) {
- setFilenameToTitle();
- }
- if( col == TableModelEvent.ALL_COLUMNS ) {
+ if( col == PlaylistTableModel.Column.FILENAME.ordinal() || col == TableModelEvent.ALL_COLUMNS ) {
setFilenameToTitle();
}
}
* @param message 確認メッセージ
* @return 確認OKのときtrue
*/
- boolean confirm(String message) {
+ public boolean confirm(String message) {
return JOptionPane.showConfirmDialog(this, message, ChordHelperApplet.VersionInfo.NAME,
JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE) == JOptionPane.YES_OPTION ;
}
/**
* 新しい {@link MidiSequenceEditor} を構築します。
- * @param deviceModelList MIDIデバイスモデルリスト
+ * @param sequencerModel シーケンサーモデル
*/
public MidiSequenceEditor(MidiSequencerModel sequencerModel) {
sequenceListTable = new SequenceListTable(new PlaylistTableModel(sequencerModel));