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