Web hosting domain - Chapter 22 Java Media Framework and Java Sound

Chapter 22 Java Media Framework and Java Sound (on CD) 1305 261 buttonPanel.add( playButton ); 262 playButton.setEnabled( false ); 263 264 listenButton = new JButton( “Play MIDI” ); 265 266 // register an ActionListener for listenButton events 267 listenButton.addActionListener( 268 269 // anonymous inner class to handle listenButton events 270 new ActionListener() { 271 272 // playback MIDI file 273 public void actionPerformed( ActionEvent event ) 274 { 275 File midiFile = getFile(); 276 277 if ( midiFile == null ) 278 return; 279 280 midiData = new MidiData(); 281 282 // prepare MIDI track 283 if ( midiData.initialize( midiFile ) == false ) 284 return; 285 286 // play MIDI data 287 midiData.play(); 288 } 289 290 } // end ActionListener 291 292 ); // end call to method addActionListener 293 294 buttonPanel.add( listenButton ); 295 296 saveButton = new JButton( “Save MIDI” ); 297 298 // register an ActionListener for saveButton events 299 saveButton.addActionListener( 300 30 // anonymous inner class to handle saveButton events 30 new ActionListener() { 30 30 // get save file and save recorded MIDI 30 public void actionPerformed( ActionEvent event ) 30 { 30 File saveFile = getSaveFile(); 30 30 if ( saveFile != null ) 310 midiRecord.saveSequence( saveFile ); 311 } 312 Fig. 22.10 MidiDemoprovides the GUI than enables users to interact with the application (part 6 of 14).
If you are in need for cheap and reliable webhost to host your website, we recommend http web server services.

Leave a Reply