import javax.swing.*;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;//ActionListener:动作监控(点击鼠标,按下空间)public class Actionlistentertestttest1 { public static void main(String[] args) { JFrame f=new JFrame(); f.setSize(500,500); f.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); f.setLayout(null); JButton jl1=new JButton(按钮); jl1.setBounds(0,0,100,100); f.getContentPane().add(jl1); jl1.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { System.out.println(“我被点了!!!!"); } }); f.setVisible(true); }}