JAL-1645 Version-Rel Version 2.9 Year-Rel 2015 Licensing glob
[jalview.git] / test / jalview / gui / JAL1353bugdemo.java
1 /*
2  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
3  * Copyright (C) 2015 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 jalview.bin.Cache;
24
25 import java.awt.Dimension;
26 import java.awt.event.ActionEvent;
27 import java.awt.event.ActionListener;
28 import java.awt.event.MouseEvent;
29 import java.awt.event.MouseListener;
30
31 import javax.swing.JDesktopPane;
32 import javax.swing.JFrame;
33 import javax.swing.JInternalFrame;
34 import javax.swing.JMenu;
35 import javax.swing.JMenuItem;
36 import javax.swing.JTextArea;
37
38 import org.testng.annotations.AfterClass;
39 import org.testng.annotations.BeforeClass;
40 import org.testng.annotations.Test;
41
42 public class JAL1353bugdemo
43 {
44
45   @BeforeClass(alwaysRun = true)
46   public static void setUpBeforeClass() throws Exception
47   {
48   }
49
50   @AfterClass
51   public static void tearDownAfterClass() throws Exception
52   {
53   }
54
55   volatile boolean finish = false;
56
57   @Test(groups = { "Functional" }, enabled = false)
58   public void test()
59   {
60     Cache.initLogger();
61     // final Desktop foo = new Desktop();
62     final JFrame cfoo = new JFrame("Crash Java");
63     final JDesktopPane foo = new JDesktopPane();
64     foo.setPreferredSize(new Dimension(600, 800));
65     cfoo.setSize(600, 800);
66     final JInternalFrame cont = new JInternalFrame("My Frame");
67     JTextArea evt;
68     cont.setPreferredSize(new Dimension(400, 300));
69     cont.add(evt = new JTextArea(
70             "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"));
71     cont.pack();
72     foo.add("A frame", cont);
73     foo.setVisible(true);
74     foo.setEnabled(true);
75     foo.doLayout();
76     cfoo.add(foo);
77     final JMenu jm = new JMenu("Do");
78     JMenuItem jmi = new JMenuItem("this");
79     jm.add(jmi);
80     evt.addMouseListener(new MouseListener()
81     {
82
83       @Override
84       public void mouseReleased(MouseEvent e)
85       {
86       }
87
88       @Override
89       public void mousePressed(MouseEvent e)
90       {
91         // TODO Auto-generated method stub
92
93       }
94
95       @Override
96       public void mouseExited(MouseEvent e)
97       {
98         // TODO Auto-generated method stub
99
100       }
101
102       @Override
103       public void mouseEntered(MouseEvent e)
104       {
105         // TODO Auto-generated method stub
106
107       }
108
109       @Override
110       public void mouseClicked(MouseEvent e)
111       {
112         // JFrame parent = new JFrame();
113         // parent.setBounds(foo.getBounds());
114         // JPanel oo = new JPanel();
115         // parent.add(oo);
116         // oo.setVisible(true);
117         // parent.setVisible(true);
118         EditNameDialog end = new EditNameDialog("Sequence Name",
119                 "Sequence Description", "label 1", "Label 2",
120                 "Try and drag between the two text fields", foo);// );cont.getRootPane());
121         assert (end != null);
122         finish = true;
123       }
124     });
125     cont.setVisible(true);
126
127     jmi.addActionListener(new ActionListener()
128     {
129
130       @Override
131       public void actionPerformed(ActionEvent arg0)
132       {
133         EditNameDialog end = new EditNameDialog("Sequence Name",
134                 "Sequence Description", "label 1", "Label 2",
135                 "Try and drag between the two text fields", cont);
136         assert (end != null);
137         finish = true;
138       }
139     });
140     foo.setVisible(true);
141     cfoo.setVisible(true);
142     while (!finish)
143     {
144       try
145       {
146         Thread.sleep(100);
147       } catch (InterruptedException x)
148       {
149       }
150     }
151   }
152
153 }