JBuilder Make audio playback program

Source: Internet
Author: User

Java is a very popular programming language in the world today. It is made by Sun Microsystems, Inc., USA. It is a language that breaks through the user-side machine environment and CPU structure for Internet development, and writes once to execute on any machine (write Once,run Anywhere).

After describing the features and benefits of Java, I'll start by introducing how to make audio playback programs. There are many packages and classes in Java that can be used to make audio playback, including Java.applet.AudioClip, Com.sun.media.sound.JavaSoundAudioClip, and javax.sound.midi.spi& Javaw.sound.sampled.spi, where Java.applet.AudioClip is an interface from the JDK1.0, the rest of the classes are implemented for this interface and enrich its functionality.

Below, I will lead you to use the Javasoundaudioclip class in Com.sun.media.sound to make a simple audio player applet.

I am using the Borland Company's JBuilder, which is a large Java integrated development environment.

We create 4 classes, as shown in the following table:

Class name MyFrame Audioplay Gifpanel Test
Function Interface GUI Play audio files A panel that holds GIF pictures Test class

1. Generate Application GUI

First, use JBuilder's wizard to automatically generate a application with a menu bar, and then add controls to the frame. As shown below:

jlist jbutton jbutton jbutton jbutton jfilechooser
name jbtnback jbtnstop jbtnforward filechooser
feature playlist > back play stop forward Open file Dialog

Add jlist below the button as a playlist, in order to avoid the monotony of the screen, we add a GIF on the right, in order to facilitate the management of GIF, we made a panel for it, forming a gifpanel class. The finished interface is shown in the following illustration:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.