JAL-1517 fix copyright for 2.8.2
[jalview.git] / test / jalview / gui / JAL1353bugdemo.java
1 /*
2  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.2)
3  * Copyright (C) 2014 The Jalview Authors
4  * 
5  * This file is part of Jalview.
6  * 
7  * Jalview is free software: you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License 
9  * as published by the Free Software Foundation, either version 3
10  * of the License, or (at your option) any later version.
11  *  
12  * Jalview is distributed in the hope that it will be useful, but 
13  * WITHOUT ANY WARRANTY; without even the implied warranty 
14  * of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
15  * PURPOSE.  See the GNU General Public License for more details.
16  * 
17  * You should have received a copy of the GNU General Public License
18  * along with Jalview.  If not, see <http://www.gnu.org/licenses/>.
19  * The Jalview Authors are detailed in the 'AUTHORS' file.
20  */
21 package jalview.gui;
22
23 import static org.junit.Assert.*;
24 import jalview.bin.Cache;
25
26 import java.awt.Component;
27 import java.awt.Dimension;
28 import java.awt.event.ActionEvent;
29 import java.awt.event.ActionListener;
30 import java.awt.event.MouseEvent;
31 import java.awt.event.MouseListener;
32
33 import javax.swing.JDesktopPane;
34 import javax.swing.JFrame;
35 import javax.swing.JInternalFrame;
36 import javax.swing.JMenu;
37 import javax.swing.JMenuItem;
38 import javax.swing.JPanel;
39 import javax.swing.JTextArea;
40
41 import org.junit.AfterClass;
42 import org.junit.BeforeClass;
43 import org.junit.Test;
44
45 public class JAL1353bugdemo
46 {
47
48   @BeforeClass
49   public static void setUpBeforeClass() throws Exception
50   {
51   }
52
53   @AfterClass
54   public static void tearDownAfterClass() throws Exception
55   {
56   }
57   volatile boolean finish=false;
58
59   @Test
60   public void test()
61   {
62     Cache.initLogger();
63     // final Desktop foo = new Desktop();
64     final JFrame cfoo = new JFrame("Crash Java");
65     final JDesktopPane foo=new JDesktopPane();
66     foo.setPreferredSize(new Dimension(600,800));
67     cfoo.setSize(600, 800);
68     final JInternalFrame cont = new JInternalFrame("My Frame");
69     JTextArea evt;
70     cont.setPreferredSize(new Dimension(400, 300));
71     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"));
72     cont.pack();
73     foo.add("A frame",cont);
74     foo.setVisible(true);
75     foo.setEnabled(true);
76     foo.doLayout();
77     cfoo.add(foo);
78     final JMenu jm = new JMenu("Do");
79     JMenuItem jmi=new JMenuItem("this");
80     jm.add(jmi);
81     evt.addMouseListener(new MouseListener()
82     {
83       
84       @Override
85       public void mouseReleased(MouseEvent e)
86       {
87       }
88       
89       @Override
90       public void mousePressed(MouseEvent e)
91       {
92         // TODO Auto-generated method stub
93         
94       }
95       
96       @Override
97       public void mouseExited(MouseEvent e)
98       {
99         // TODO Auto-generated method stub
100         
101       }
102       
103       @Override
104       public void mouseEntered(MouseEvent e)
105       {
106         // TODO Auto-generated method stub
107         
108       }
109       
110       @Override
111       public void mouseClicked(MouseEvent e)
112       {
113 //        JFrame parent = new JFrame();
114 //        parent.setBounds(foo.getBounds());
115 //        JPanel oo = new JPanel();
116 //        parent.add(oo);
117 //        oo.setVisible(true);
118 //        parent.setVisible(true);
119         EditNameDialog end =new EditNameDialog("Sequence Name", "Sequence Description","label 1", "Label 2", "Try and drag between the two text fields", foo);//);cont.getRootPane());
120         assert(end!=null);
121         finish=true;
122       }
123     });
124     cont.setVisible(true);
125
126     jmi.addActionListener(new ActionListener()
127     {
128       
129       @Override
130       public void actionPerformed(ActionEvent arg0)
131       {
132         EditNameDialog end =new EditNameDialog("Sequence Name", "Sequence Description","label 1", "Label 2", "Try and drag between the two text fields", cont);
133         assert(end!=null);
134         finish=true;
135       }
136     });
137     foo.setVisible(true);
138     cfoo.setVisible(true);
139     while (!finish)
140     {
141       try {
142         Thread.sleep(100);
143       } catch (InterruptedException x) {}
144     }
145   }
146
147 }