易截截图软件、单文件、免安装、纯绿色、仅160KB

基于Java的简易播放器

 在Java Aplication中实现的简易播放器。来源于胡巧多主编的《Java程序设计案例教程》
我试运行过了,其中的 “听海.wav”,“一定要爱你.wav”音频文件要放在class所在的文件夹中,且只支持wav格式
源代码:
import java.applet.Applet;
import java.applet.AudioClip;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.net.*;
public class TestAudioClip extends JFrame implements ActionListener,ItemListener {
 
 
 
  boolean looping=false;
  
  
  String[] chioces={"听海.wav","一定要爱你.wav"};
  
  URL sound1File1=getClass().getResource(chioces[0]);
  URL sound2File2=getClass().getResource(chioces[1]);
  //private AudioClip sound1;
  
  AudioClip sound1=Applet.newAudioClip(sound1File1);
  AudioClip sound2=Applet.newAudioClip(sound2File2);
  AudioClip chosenClip=sound1;
  
  JComboBox soundFiles=new JComboBox(chioces);
  JButton playButton=new JButton("开始播放");
  JButton loopButton=new JButton("循环播放");
  JButton stopButton=new JButton("停止播放");
  JLabel status=new JLabel("请选择播放的音乐");
  JPanel controlPanel=new JPanel();
  Container container=getContentPane();
  
  
  public TestAudioClip(){
   
   super("音乐播放器");
   soundFiles.setBackground(Color.yellow);
   soundFiles.setSelectedIndex(0);
   soundFiles.addItemListener(this);
   
   playButton.addActionListener((java.awt.event.ActionListener) this);
   loopButton.addActionListener((java.awt.event.ActionListener) this);
   stopButton.addActionListener((java.awt.event.ActionListener) this);
   stopButton.setEnabled(false);
  


相关文档:

Java中的泛型

    1、Java.util的集合类中的元素必须是对象化的,他们不能是基本类型。如不能声明Set<char>或List<int>。但对List<Integer>,可以往里面加int型数据,它会用Java的autoboxing机制自动转换成Integer对象。
    2、参数化类中的类型参数可以是数组类型,如Map< ......

JAVA连接ACCESS,SQL Server,MySQL,Oracle

import java.sql.*;
/*
* JAVA连接ACCESS,SQL Server,MySQL,Oracle数据库
*
* */
public class JDBC {
  
public static void main(String[] args)throws Exception {
  
   Connection conn=null;
  
       //====连接ACCESS数据库 ......

java字符串处理类

自己收集的一些java处理类,供以后查询
package com.tools;
import java.text.SimpleDateFormat;
import java.util.Date;
public class StringHandler {

/******************************
* 功能:将IP地址转换为对应的整数
* 返回类型:long
******************************/
public static long getI ......

Java communications API 实现并行端口打印

使用 Java communications API 实现并行端口打印
 
这是一个在客户支持中遇到的新问题,我在相关的网站([url]www.rxtx.org[/url] and [url]www.sun.com.cn[/url])上找到了一些有用的信息,最后终于在Windows XP 和 LinuxIA32 平台下实现并行端口打印这一功能。
 
首先,我们要从SUN的网站下载Java communicat ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号