@@ -0,0 +1,1242 @@
+/* Copyright %5B2016%5D %5BWill Shen%5D%0D%0A *%0D%0A * Licensed under the Apache License, Version 2.0 (the %22License%22);%0D%0A * you may not use this file except in compliance with the License.%0D%0A * You may obtain a copy of the License at%0D%0A * %0D%0A *   http://www.apache.org/licenses/LICENSE-2.0%0D%0A * %0D%0A * Unless required by applicable law or agreed to in writing, software%0D%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0D%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0D%0A * See the License for the specific language governing permissions and%0D%0A * limitations under the License.%0D%0A */%0D%0A%0D%0A/**%0D%0A * @author muyousome%0D%0A * @since 2016-7-15 08:26:44%0D%0A *  Java%E4%BA%8B%E4%BB%B6%E5%A4%84%E7%90%86%E6%9C%BA%E5%88%B6%EF%BC%8C%E5%9C%A8%E7%BB%84%E4%BB%B6%E4%B8%8A%E6%B3%A8%E5%86%8C%E7%9B%91%E5%90%AC%E5%99%A8%0D%0A */%0D%0A%0D%0Aimport java.awt.*;%0D%0Aimport java.awt.event.*;%0D%0A%0D%0A%0D%0Aclass TestActionEvent %7B%0D%0A    public static void main(String%5B%5D args) %7B%0D%0A        Frame f = new Frame(%22test%22);%0D%0A        Button b = new Button(%22Press%22);%0D%0A        Monitor bh = new Monitor();%0D%0A        b.addActionListener(bh);%0D%0A        f.add(b, BorderLayout.CENTER);%0D%0A        f.pack();%0D%0A        f.setVisible(true);%0D%0A    %7D%0D%0A%7D%0D%0A%0D%0Aclass Monitor implements ActionListener %7B%0D%0A    public void actionPerformed(ActionEvent e) %7B%0D%0A        System.out.println(%22A button has been pressed !%22);%0D%0A        %0D%0A    %7D%0D%0A%7D

add 事件处理和监听