• java 小综合


    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.io.FileInputStream;
    import java.io.InputStream;

    import javax.swing.ImageIcon;
    import javax.swing.JButton;
    import javax.swing.JFrame;
    import javax.swing.JLabel;

    import sun.audio.AudioPlayer;
    import sun.audio.AudioStream;

    public class Audio extends JFrame implements ActionListener{
     ImageIcon c1=new ImageIcon("D:\2.jpg");
     JLabel la;
     JButton start;
     AudioStream as;
     public Audio()
     {
      super("sdfhg");
      setLayout(null);
      setBounds(222, 220, 580, 620);
      
      
       try{ 
                 InputStream in = new FileInputStream ("D:\渴望.au");
                 //打开一个声音文件流作为输入
                 as = new AudioStream (in);
          }catch( Exception e){
                 e.printStackTrace();
         }             
      la=new JLabel();
      la.setIcon(c1);
      //la.setBounds(0, 0, 450, 468);
      start=new JButton("start");
      start.addActionListener(this);
      add(la);
      add(start);
      start.setBounds(500,0,50,30);
      la.setBounds(0,0,450,468);
      setVisible(true);
     }

     /**
      * @param args
      */
     public void actionPerformed(ActionEvent e) {
      // TODO Auto-generated method stub
      if(as==null)
       System.out.print("meizhao");
      Object ss=e.getSource();
      if(ss==start)
         AudioPlayer.player.stop(as);  
      
     }
     public static void main(String[] args) {
      // TODO Auto-generated method stub
      Audio au=new Audio();

     }

    }

  • 相关阅读:
    软件体系风格选择小结
    bert入门资料
    RNN入门和seq2seq
    推荐系统论文源码笔记——依次学习之DKN源码笔记
    Mac os下gcc编译错误解决方案
    ns3 安装方法
    angular http ajax header
    javascript 实现htmlEncode htmlDecode
    windows下的python扩展包下载地址
    php版DES
  • 原文地址:https://www.cnblogs.com/zhangdashuai/p/3468048.html
Copyright © 2020-2023  润新知