TAILIEUCHUNG - Java Swing phần 4

Nên biết trước lập trình: bạn nên thay thế này với một tương đương với JMF khi đó là / / sẵn sàng cho tất cả các nền tảng giao hàng của bạn. nhập khẩu .*; AudioAccessory lớp công cộng kéo dài JPanel thực hiện | Java Swing - O Reilly import . import . import . import . import . Caveat programmer you should replace this with a JMF equivalent when that s ready for all of your delivery platforms. import . public class AudioAccessory extends JPanel implements PropertyChangeListener AudioClip currentClip String currentName JLabel fileLabel JButton playButton stopButton public AudioAccessory Set up the accessory. The file chooser will give us a reasonable size. setLayout new BorderLayout add fileLabel new JLabel Clip Name JPanel p new JPanel playButton new JButton Play stopButton new JButton Stop false false playButton stopButton add p new ActionListener public void actionPerformed ActionEvent e if currentClip null new ActionListener public void actionPerformed ActionEvent e if currentClip null public void propertyChange PropertyChangeEvent e if .equals Ok the user selected a file in the chooser File f File Make reasonably sure it s an audio file if .toLowerCase .endsWith .au setCurrentClip f else setCurrentClip null - 298 - Java Swing - O Reilly public void setCurrentClip File f Make sure we have a real file otherwise disable the buttons if f null null no audio selected false false return Ok seems the audio file is real so load it and enable the buttons String name if currentName return if currentClip null currentName name try URL u new URL file currentClip new AppletAudioClip u catch Exception e currentClip null Error loading clip. name .

TỪ KHÓA LIÊN QUAN
TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.