急啊~~~~~~~~~~~~~没人回答吗???????????????晕~~~~~~~~~~~~~`

解决方案 »

  1.   

    package ejb;
    import java.awt.*;
    import java.awt.event.*;public class ActionTest extends WindowAdapter implements ActionListener
    {
    Frame mainFrame;
    Label label;
    Button button;
    public ActionTest()
    {
    mainFrame=new Frame("事件测试");
    label=new Label("效果显示");
    button=new Button("A"); mainFrame.setLayout(null);
    label.setBounds(20,30,200,23);
    button.setBounds(20,63,70,23); mainFrame.add(label);
    mainFrame.add(button); button.addMouseListener(new MouseListener()//这里是你需要参考的地方,就是对每个按牛单独增加事件舰艇器
    {
    public void mousePressed(MouseEvent me)
    {
    label.setText("鼠标按下");
    }
    public void mouseReleased(MouseEvent me)
    {
    }
    public void mouseClicked(MouseEvent me)
    {
    label.setText("鼠标单击");
    }
    public void mouseExited(MouseEvent me)
    {
    label.setText("鼠标离开");
    }
    public void mouseEntered(MouseEvent me)
    {
    label.setText("鼠标进入");
    }
    }
    );
    mainFrame.addWindowListener(this);
    mainFrame.setSize(250,100);
    mainFrame.setBackground(new Color(212,208,200));
    mainFrame.setVisible(true);
    mainFrame.setResizable(false);
    }
    public static void main(String[]args)
    {
    ActionTest actiontest=new ActionTest();
    }
    public void windowClosing(WindowEvent we)
    {
    System.exit(0);
    }
    public void actionPerformed(ActionEvent ae)
    {
    }
    }
      

  2.   

    能看明白吧?看了上面的,你的问题也就应该解决了。