@@ -0,0 +1,773 @@
+import java.awt.*;%0Aimport javax.swing.*;%0A%0Apublic class SwingObserverExample %7B%0A    JFrame frame;%0A%0A    public static void main(String%5B%5D args) %7B%0A        SwingObserverExample example = new SwingObserverExample();%0A        example.go();%0A    %7D%0A%0A    public void go() %7B%0A        frame = new JFrame();%0A        JButton button = new JButton(%22Should I do it?%22);%0A        button.addActionListener(event -%3E%0A            System.out.println(%22Don't do it, you might regret it!%22)%0A        );%0A        button.addActionListener(event -%3E%0A            System.out.println(%22Come on, do it!%22)%0A        );%0A        frame.getContentPane().add(BorderLayout.CENTER, button);%0A%0A        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);%0A        frame.setSize(300, 300);%0A        frame.setVisible(true);%0A    %7D%0A%7D%0A

Add observer pattern example, swing