Chapter 22 Java Media Framework and Java Sound (Web domain)

Chapter 22 Java Media Framework and Java Sound (on CD) 1251 39 // input and output data sources 40 private DataSource inSource, outSource; 41 42 // file writer for captured media 43 private DataSink dataSink; 44 45 // processor to render and save captured media 46 private Processor processor; 47 48 // constructor for CapturePlayer 49 public CapturePlayer() 50 { 51 super( “Capture Player” ); 52 53 // panel containing buttons 54 JPanel buttonPanel = new JPanel(); 55 getContentPane().add( buttonPanel ); 56 57 // button for accessing and initializing capture devices 58 captureButton = new JButton( “Capture and Save File” ); 59 buttonPanel.add( captureButton, BorderLayout.CENTER ); 60 61 // register an ActionListener for captureButton events 62 captureButton.addActionListener( new CaptureHandler() ); 63 64 // turn on light rendering to enable compatibility 65 // with lightweight GUI components 66 Manager.setHint( Manager.LIGHTWEIGHT_RENDERER, 67 Boolean.TRUE ); 68 69 // register a WindowListener to frame events 70 addWindowListener( 71 72 // anonymous inner class to handle WindowEvents 73 new WindowAdapter() { 74 75 // dispose processor 76 public void windowClosing( 77 WindowEvent windowEvent ) 78 { 79 if ( processor != null ) 80 processor.close(); 81 } 82 83 } // end WindowAdapter 84 85 ); // end call to method addWindowListener 86 87 } // end constructor 88 89 // action handler class for setting up device 90 private class CaptureHandler implements ActionListener { 91 Fig. 22.2Formatting and saving media from capture devices (part 2 of 9). Fig. 22.2
Check Tomcat Web Hosting services for best quality webspace to host your web application.

Leave a Reply