Chapter 22 Java Media (Web site directory) Framework and Java Sound
Chapter 22 Java Media Framework and Java Sound (on CD) 1303 157 // set up configuration controls 158 private void makeConfigureControls() 159 { 160 JPanel configurePanel = 161 new JPanel( new GridLayout( 5, 1 ) ); 162 163 controlPanel.add( configurePanel, BorderLayout.WEST ); 164 165 instrumentBox = new JComboBox( 166 midiSynthesizer.getInstruments() ); 167 168 configurePanel.add( instrumentBox ); 169 170 // register an ActionListener for instrumentBox events 171 instrumentBox.addActionListener( 172 173 // anonymous inner class to handle instrument selector 174 new ActionListener() { 175 176 // change current instrument program 177 public void actionPerformed( ActionEvent event ) 178 { 179 // change instrument in synthesizer 180 midiSynthesizer.changeInstrument( 181 instrumentBox.getSelectedIndex() ); 182 } 183 184 } // end ActionListener 185 186 ); // end call to method addActionListener 187 188 JLabel volumeLabel = new JLabel( “volume” ); 189 configurePanel.add( volumeLabel ); 190 191 volumeSlider = new JSlider( 192 SwingConstants.HORIZONTAL, 5, 80, 30 ); 193 194 // register a ChangeListener for slider change events 195 volumeSlider.addChangeListener( 196 197 // anonymous inner class to handle volume slider events 198 new ChangeListener() { 199 200 // change volume 201 public void stateChanged( ChangeEvent changeEvent ) 202 { 203 midiVolume = volumeSlider.getValue(); 204 } 205 206 } // end class ChangeListener 207 208 ); // end call to method addChangeListener Fig. 22.10 MidiDemoprovides the GUI than enables users to interact with the application (part 4 of 14).
If you are looking for cheap and quality webhost to host and run your website check Jboss Web Hosting services.