标签:通过 设置 public operation rgs blog new main ext
// 通过匿名类实现监听器 public class ActionMonitor extends JFrame { JButton button; public ActionMonitor(){ this.setLayout(null);//布局 this.setSize(500,400);//大小 this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);//设置可以关闭 button =new JButton(); button.setBounds(200, 200, 100, 20);//位置和大小 button.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { // TODO Auto-generated method stub } });//添加监听 this.setVisible(true);// 设置可见性 this.add(button); } public static void main(String[] args) { ActionMonitor am= new ActionMonitor(); } }
标签:通过 设置 public operation rgs blog new main ext
原文地址:http://www.cnblogs.com/test1234/p/6852850.html