OSDN Git Service

起動直後に「Starting...」画面を表示するようにした
authorAkiyoshi Kamide <kamide@yk.rim.or.jp>
Tue, 23 May 2017 16:23:04 +0000 (01:23 +0900)
committerAkiyoshi Kamide <kamide@yk.rim.or.jp>
Tue, 23 May 2017 16:23:04 +0000 (01:23 +0900)
src/camidion/chordhelper/ChordHelperApplet.java
src/camidion/chordhelper/MidiChordHelper.java

index 9b00641..fa306f3 100644 (file)
@@ -274,7 +274,7 @@ public class ChordHelperApplet extends JApplet {
         */
        public static class VersionInfo {
                public static final String NAME = "MIDI Chord Helper";
-               public static final String VERSION = "Ver.20170518.1";
+               public static final String VERSION = "Ver.20170523.1";
                public static final String COPYRIGHT = "Copyright (C) 2004-2017";
                public static final String AUTHER = "@きよし - Akiyoshi Kamide";
                public static final String URL = "http://www.yk.rim.or.jp/~kamide/music/chordhelper/";
index 75810c4..114740b 100644 (file)
@@ -74,31 +74,43 @@ public class MidiChordHelper extends JFrame implements AppletStub, AppletContext
                updateFilename(((PlaylistTableModel)event.getSource()).getSequencerModel());
        }
        private MidiChordHelper(List<File> fileList) {
-               ChordHelperApplet applet = new ChordHelperApplet();
-               add(applet, BorderLayout.CENTER);
-               add(statusBar, BorderLayout.SOUTH);
-               applet.setStub(this);
-               applet.init();
-               setIconImage(applet.getIconImage());
+               setTitle(ChordHelperApplet.VersionInfo.NAME);
+               JLabel startingLabel = new JLabel(
+                       "<html>"
+                       +"<div width=300 height=50 style='font-size: 120%; font-style: italic; text-align: center;'>"
+                       +"Starting...</div>"
+                       +"</html>");
+               add(startingLabel);
                pack();
                setLocationRelativeTo(null);
-               setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
-               addWindowListener(new WindowAdapter() {
-                       @Override
-                       public void windowClosing(WindowEvent event) {
-                               if( applet.isModified() && ! confirmBeforeExit() ) return;
-                               applet.destroy();
-                               System.exit(0);
-                       }
-               });
-               PlaylistTableModel playlist = applet.midiEditor.getPlaylistModel();
-               MidiSequencerModel sequencer = playlist.getSequencerModel();
-               sequencer.addChangeListener(e->updateFilename((MidiSequencerModel)e.getSource()));
-               playlist.addTableModelListener(e->updateFilename(e));
-               updateFilename(sequencer);
                setVisible(true);
-               applet.start();
-               applet.midiEditor.play(fileList);
+               SwingUtilities.invokeLater(()->{
+                       ChordHelperApplet applet = new ChordHelperApplet();
+                       remove(startingLabel);
+                       add(applet, BorderLayout.CENTER);
+                       add(statusBar, BorderLayout.SOUTH);
+                       applet.setStub(this);
+                       applet.init();
+                       setIconImage(applet.getIconImage());
+                       pack();
+                       setLocationRelativeTo(null);
+                       setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
+                       addWindowListener(new WindowAdapter() {
+                               @Override
+                               public void windowClosing(WindowEvent event) {
+                                       if( applet.isModified() && ! confirmBeforeExit() ) return;
+                                       applet.destroy();
+                                       System.exit(0);
+                               }
+                       });
+                       PlaylistTableModel playlist = applet.midiEditor.getPlaylistModel();
+                       MidiSequencerModel sequencer = playlist.getSequencerModel();
+                       sequencer.addChangeListener(e->updateFilename((MidiSequencerModel)e.getSource()));
+                       playlist.addTableModelListener(e->updateFilename(e));
+                       updateFilename(sequencer);
+                       applet.start();
+                       applet.midiEditor.play(fileList);
+               });
        }
        @Override
        public boolean isActive() { return true; }