package name.panitz.swing.threadTest;

import javax.swing.JFrame;
import javax.swing.JButton;
import java.awt.event.*;

public class GuiHangs {
  public static void main(String [] _){
    JFrame f1 = new JFrame("f1");
    JFrame f2 = new JFrame("f2");
    JButton b1 = new JButton("b1");
    JButton b2 = new JButton("b2");

    b1.addActionListener(new ActionListener(){
      public void actionPerformed(ActionEvent _){
        System.out.println("b1 action");
      }
    });

    b2.addActionListener(new ActionListener(){
      public void actionPerformed(ActionEvent _){
        System.out.println("b2 action");
        while (true){}
      }
    });

    f1.getContentPane().add(b1);
    f2.getContentPane().add(b2);
    f1.pack();
    f2.pack();
    f1.setVisible(true);
    f2.setVisible(true);
  }
}