单击不同的按钮,显示不同的内容到字段域
3个按钮都绑定了时间监听器对象
在一个继承mouselistener借口的类的public void mouseClicked(MouseEvent e) 方法中
如何实现,不懂的就是怎么判断按钮被单击

解决方案 »

  1.   

    可以实现ActionListner(ActionEvent)
    比如:
        if (event.getSource.instanceof("JButton")
      

  2.   

    button1 = new JButton("按钮1");  //添加按钮
    button1.addActionListener(this); //添加按钮事件
    if(e.getSource() == button1) //判断你的按钮事件如果为button1的话执行方法体内的操作
    {
    /*
    你要进行的操作!
    */
    }
      

  3.   

    可以实现ActionListner(ActionEvent event)//这个是方法吗? 是public void actionPerformed(ActionEvent event)吗?这里是不是还要加上event呢对应你下面的比如:
        if (event.getSource.instanceof("JButton")//instanceof是什么?接触不多不是很了解哦
      

  4.   

    可以实现ActionListner(ActionEvent event),ActionListner监听所有的action,可以包括鼠标键盘等事件,而下面的event就要跟上面的对应,然后这个event就用来捕捉时间的发生,instanceof应该就是哦event所捕捉的时间为JButton