Forces init of alignPanel if annotations added
[jalview.git] / src / jalview / jbgui / GAlignmentPanel.java
1 /*\r
2  * Jalview - A Sequence Alignment Editor and Viewer\r
3  * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
4  *\r
5  * This program is free software; you can redistribute it and/or\r
6  * modify it under the terms of the GNU General Public License\r
7  * as published by the Free Software Foundation; either version 2\r
8  * of the License, or (at your option) any later version.\r
9  *\r
10  * This program is distributed in the hope that it will be useful,\r
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
13  * GNU General Public License for more details.\r
14  *\r
15  * You should have received a copy of the GNU General Public License\r
16  * along with this program; if not, write to the Free Software\r
17  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA\r
18  */\r
19 package jalview.jbgui;\r
20 \r
21 import java.awt.*;\r
22 import javax.swing.*;\r
23 import javax.swing.border.*;\r
24 \r
25 public class GAlignmentPanel\r
26     extends JPanel\r
27 {\r
28   protected JPanel sequenceHolderPanel = new JPanel();\r
29   protected JScrollBar vscroll = new JScrollBar();\r
30   protected JScrollBar hscroll = new JScrollBar();\r
31   protected JPanel seqPanelHolder = new JPanel();\r
32   BorderLayout borderLayout1 = new BorderLayout();\r
33   BorderLayout borderLayout3 = new BorderLayout();\r
34   protected JPanel scalePanelHolder = new JPanel();\r
35   protected JPanel idPanelHolder = new JPanel();\r
36   BorderLayout borderLayout5 = new BorderLayout();\r
37   protected JPanel idSpaceFillerPanel1 = new JPanel();\r
38   public JPanel annotationSpaceFillerHolder = new JPanel();\r
39   BorderLayout borderLayout6 = new BorderLayout();\r
40   ButtonGroup buttonGroup1 = new ButtonGroup();\r
41   BorderLayout borderLayout7 = new BorderLayout();\r
42   JPanel hscrollHolder = new JPanel();\r
43   BorderLayout borderLayout10 = new BorderLayout();\r
44   protected JPanel hscrollFillerPanel = new JPanel();\r
45   BorderLayout borderLayout11 = new BorderLayout();\r
46   public JScrollPane annotationScroller = new JScrollPane();\r
47   Border border1;\r
48   BorderLayout borderLayout4 = new BorderLayout();\r
49 \r
50   public GAlignmentPanel()\r
51   {\r
52     try\r
53     {\r
54       jbInit();\r
55     }\r
56     catch (Exception e)\r
57     {\r
58       e.printStackTrace();\r
59     }\r
60   }\r
61 \r
62   private void jbInit()\r
63       throws Exception\r
64   {\r
65     border1 = BorderFactory.createLineBorder(Color.gray, 1);\r
66     idPanelHolder.setBorder(null);\r
67     idPanelHolder.setPreferredSize(new Dimension(70, 10));\r
68     this.setLayout(borderLayout7);\r
69     sequenceHolderPanel.setMaximumSize(new Dimension(2147483647, 2147483647));\r
70     sequenceHolderPanel.setMinimumSize(new Dimension(150, 150));\r
71     sequenceHolderPanel.setPreferredSize(new Dimension(150, 150));\r
72     sequenceHolderPanel.setLayout(borderLayout3);\r
73     seqPanelHolder.setLayout(borderLayout1);\r
74     scalePanelHolder.setBackground(Color.white);\r
75     scalePanelHolder.setMinimumSize(new Dimension(10, 80));\r
76     scalePanelHolder.setPreferredSize(new Dimension(10, 30));\r
77     scalePanelHolder.setLayout(borderLayout6);\r
78     idPanelHolder.setLayout(borderLayout5);\r
79     idSpaceFillerPanel1.setBackground(Color.white);\r
80     idSpaceFillerPanel1.setPreferredSize(new Dimension(10, 30));\r
81     idSpaceFillerPanel1.setLayout(borderLayout11);\r
82     annotationSpaceFillerHolder.setBackground(Color.white);\r
83     annotationSpaceFillerHolder.setPreferredSize(new Dimension(10, 80));\r
84     annotationSpaceFillerHolder.setLayout(borderLayout4);\r
85     hscroll.setOrientation(JScrollBar.HORIZONTAL);\r
86     hscrollHolder.setLayout(borderLayout10);\r
87     hscrollFillerPanel.setBackground(Color.white);\r
88     hscrollFillerPanel.setPreferredSize(new Dimension(70, 10));\r
89     hscrollHolder.setBackground(Color.white);\r
90     annotationScroller.setBorder(null);\r
91     annotationScroller.setPreferredSize(new Dimension(10, 80));\r
92     this.setPreferredSize(new Dimension(220, 166));\r
93 \r
94     sequenceHolderPanel.add(scalePanelHolder, BorderLayout.NORTH);\r
95     sequenceHolderPanel.add(seqPanelHolder, BorderLayout.CENTER);\r
96     seqPanelHolder.add(vscroll, BorderLayout.EAST);\r
97     sequenceHolderPanel.add(annotationScroller, BorderLayout.SOUTH);\r
98 \r
99     //  jPanel3.add(secondaryPanelHolder,  BorderLayout.SOUTH);\r
100     this.add(idPanelHolder, BorderLayout.WEST);\r
101     idPanelHolder.add(idSpaceFillerPanel1, BorderLayout.NORTH);\r
102     idPanelHolder.add(annotationSpaceFillerHolder, BorderLayout.SOUTH);\r
103     this.add(hscrollHolder, BorderLayout.SOUTH);\r
104     hscrollHolder.add(hscroll, BorderLayout.CENTER);\r
105     hscrollHolder.add(hscrollFillerPanel, BorderLayout.WEST);\r
106     this.add(sequenceHolderPanel, BorderLayout.CENTER);\r
107   }\r
108 }\r