借这个地方请教:
日期输入的时候用那个图形控件,我是在jBuilder9中写软件。
谢谢大家!

解决方案 »

  1.   

    用if不就行了吗?
    import java.awt.*;
    import java.applet.*;
    import java.awt.event.*;
    public class Player extends Applet implements ActionListener
    {
    Button play,stop,loop;
    AudioClip mySong;
    public void init() 
    {
    play=new Button("播放");
    add(play);
    play.addActionListener(this);
    stop=new Button("停止");
    add(stop);
    stop.addActionListener(this);
    loop=new Button("循环");
    add(loop);
    loop.addActionListener(this);
    mySong=getAudioClip(getDocumentBase(),"spacemusic.au");
    }
    public void actionPerformed(ActionEvent e)
    {
    if(e.getSource()==play)
    {
    //javax.swing.JOptionPane.showMessageDialog(null,"ok");
    mySong.play();

    }
    if(e.getSource()==stop)
    mySong.stop();
    if(e.getSource()==loop)
    mySong.loop();
    }
    }
      

  2.   

    问一下,如果使用switch,应该如何做,而不是用 if