JAL-1517 update copyright to version 2.8.2
[jalview.git] / test / jalview / gui / JAL1353bugdemo.java
1 package jalview.gui;
2
3 import static org.junit.Assert.*;
4 import jalview.bin.Cache;
5
6 import java.awt.Component;
7 import java.awt.Dimension;
8 import java.awt.event.ActionEvent;
9 import java.awt.event.ActionListener;
10 import java.awt.event.MouseEvent;
11 import java.awt.event.MouseListener;
12
13 import javax.swing.JDesktopPane;
14 import javax.swing.JFrame;
15 import javax.swing.JInternalFrame;
16 import javax.swing.JMenu;
17 import javax.swing.JMenuItem;
18 import javax.swing.JPanel;
19 import javax.swing.JTextArea;
20
21 import org.junit.AfterClass;
22 import org.junit.BeforeClass;
23 import org.junit.Test;
24
25 public class JAL1353bugdemo
26 {
27
28   @BeforeClass
29   public static void setUpBeforeClass() throws Exception
30   {
31   }
32
33   @AfterClass
34   public static void tearDownAfterClass() throws Exception
35   {
36   }
37   volatile boolean finish=false;
38
39   @Test
40   public void test()
41   {
42     Cache.initLogger();
43     // final Desktop foo = new Desktop();
44     final JFrame cfoo = new JFrame("Crash Java");
45     final JDesktopPane foo=new JDesktopPane();
46     foo.setPreferredSize(new Dimension(600,800));
47     cfoo.setSize(600, 800);
48     final JInternalFrame cont = new JInternalFrame("My Frame");
49     JTextArea evt;
50     cont.setPreferredSize(new Dimension(400, 300));
51     cont.add(evt=new JTextArea("Click here and drag text over this window to freeze java.\n\nThis is a dummy string. See teh dummy string go.\nThis is a dummy string. See teh dummy string go.\nThis is a dummy string. See teh dummy string go.\nThis is a dummy string. See teh dummy string go.\nThis is a dummy string. See teh dummy string go.\nThis is a dummy string. See teh dummy string go.\nThis is a dummy string. See teh dummy string go.\nThis is a dummy string. See teh dummy string go.\nThis is a dummy string. See teh dummy string go.\nThis is a dummy string. See teh dummy string go.\nThis is a dummy string. See teh dummy string go.\nThis is a dummy string. See teh dummy string go.\nThis is a dummy string. See teh dummy string go.\n"));
52     cont.pack();
53     foo.add("A frame",cont);
54     foo.setVisible(true);
55     foo.setEnabled(true);
56     foo.doLayout();
57     cfoo.add(foo);
58     final JMenu jm = new JMenu("Do");
59     JMenuItem jmi=new JMenuItem("this");
60     jm.add(jmi);
61     evt.addMouseListener(new MouseListener()
62     {
63       
64       @Override
65       public void mouseReleased(MouseEvent e)
66       {
67       }
68       
69       @Override
70       public void mousePressed(MouseEvent e)
71       {
72         // TODO Auto-generated method stub
73         
74       }
75       
76       @Override
77       public void mouseExited(MouseEvent e)
78       {
79         // TODO Auto-generated method stub
80         
81       }
82       
83       @Override
84       public void mouseEntered(MouseEvent e)
85       {
86         // TODO Auto-generated method stub
87         
88       }
89       
90       @Override
91       public void mouseClicked(MouseEvent e)
92       {
93 //        JFrame parent = new JFrame();
94 //        parent.setBounds(foo.getBounds());
95 //        JPanel oo = new JPanel();
96 //        parent.add(oo);
97 //        oo.setVisible(true);
98 //        parent.setVisible(true);
99         EditNameDialog end =new EditNameDialog("Sequence Name", "Sequence Description","label 1", "Label 2", "Try and drag between the two text fields", foo);//);cont.getRootPane());
100         assert(end!=null);
101         finish=true;
102       }
103     });
104     cont.setVisible(true);
105
106     jmi.addActionListener(new ActionListener()
107     {
108       
109       @Override
110       public void actionPerformed(ActionEvent arg0)
111       {
112         EditNameDialog end =new EditNameDialog("Sequence Name", "Sequence Description","label 1", "Label 2", "Try and drag between the two text fields", cont);
113         assert(end!=null);
114         finish=true;
115       }
116     });
117     foo.setVisible(true);
118     cfoo.setVisible(true);
119     while (!finish)
120     {
121       try {
122         Thread.sleep(100);
123       } catch (InterruptedException x) {}
124     }
125   }
126
127 }