b703b47efd49185128c30ae3da8c997a440493ca
[jalview.git] / src / jalview / jbgui / GAlignmentPanel.java
1 /*
2  * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
3  * Copyright (C) $$Year-Rel$$ 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.jbgui;
22
23 import java.awt.BorderLayout;
24 import java.awt.Color;
25 import java.awt.Dimension;
26
27 import javax.swing.BorderFactory;
28 import javax.swing.ButtonGroup;
29 import javax.swing.JPanel;
30 import javax.swing.JScrollBar;
31 import javax.swing.JScrollPane;
32 import javax.swing.border.Border;
33
34 @SuppressWarnings("serial")
35 public class GAlignmentPanel extends JPanel
36 {
37           protected JScrollBar vscroll = new JScrollBar();
38
39           protected JScrollBar hscroll = new JScrollBar();
40
41           BorderLayout borderLayout1 = new BorderLayout();
42
43           BorderLayout borderLayout3 = new BorderLayout();
44
45           BorderLayout borderLayout5 = new BorderLayout();
46
47           BorderLayout borderLayout6 = new BorderLayout();
48
49           ButtonGroup buttonGroup1 = new ButtonGroup();
50
51           BorderLayout borderLayout7 = new BorderLayout();
52
53           BorderLayout borderLayout10 = new BorderLayout();
54
55           BorderLayout borderLayout11 = new BorderLayout();
56
57   public JScrollPane annotationScroller = new JScrollPane();
58
59           Border border1;
60
61           BorderLayout borderLayout4 = new BorderLayout();
62
63           
64           static JPanel newJPanel() {  // BH 2019
65                   JPanel p = new JPanel();
66                   // leaving this in, as it prevents 
67                   // the checkerboard business, despite how
68                   // funky that looks. Remove if you want to.
69                   p.setBackground(Color.white);
70                         return p;
71           }
72
73   protected JPanel sequenceHolderPanel = newJPanel();
74   protected JPanel seqPanelHolder = newJPanel();
75   protected JPanel scalePanelHolder = newJPanel();
76   protected JPanel idPanelHolder = newJPanel();
77   protected JPanel idSpaceFillerPanel1 = newJPanel();
78   public JPanel annotationSpaceFillerHolder = newJPanel();
79   protected JPanel hscrollFillerPanel = newJPanel();
80   JPanel hscrollHolder = newJPanel();
81
82
83
84   public GAlignmentPanel()
85   {
86     try
87     {
88       jbInit();
89     } catch (Exception e)
90     {
91       e.printStackTrace();
92     }
93   }
94
95   private void jbInit() throws Exception
96   {
97         //  annotationScroller.setBackground(Color.white);  // BH 2019
98           
99     border1 = BorderFactory.createLineBorder(Color.gray, 1);
100     idPanelHolder.setBorder(null);
101     idPanelHolder.setPreferredSize(new Dimension(70, 10));
102     this.setLayout(borderLayout7);
103     sequenceHolderPanel
104             .setMaximumSize(new Dimension(2147483647, 2147483647));
105     sequenceHolderPanel.setMinimumSize(new Dimension(150, 150));
106     sequenceHolderPanel.setPreferredSize(new Dimension(150, 150));
107     sequenceHolderPanel.setLayout(borderLayout3);
108     seqPanelHolder.setLayout(borderLayout1);
109     scalePanelHolder.setBackground(Color.white);
110     scalePanelHolder.setMinimumSize(new Dimension(10, 80));
111     scalePanelHolder.setPreferredSize(new Dimension(10, 30));
112     scalePanelHolder.setLayout(borderLayout6);
113     idPanelHolder.setLayout(borderLayout5);
114     idSpaceFillerPanel1.setBackground(Color.white);
115     idSpaceFillerPanel1.setPreferredSize(new Dimension(10, 30));
116     idSpaceFillerPanel1.setLayout(borderLayout11);
117     annotationSpaceFillerHolder.setBackground(Color.white);
118     annotationSpaceFillerHolder.setPreferredSize(new Dimension(10, 80));
119     annotationSpaceFillerHolder.setLayout(borderLayout4);
120     hscroll.setOrientation(JScrollBar.HORIZONTAL);
121     hscrollHolder.setLayout(borderLayout10);
122     hscrollFillerPanel.setBackground(Color.white);
123     hscrollFillerPanel.setPreferredSize(new Dimension(70, 10));
124     hscrollHolder.setBackground(Color.white);
125     annotationScroller.setBorder(null);
126     annotationScroller.setPreferredSize(new Dimension(10, 80));
127     this.setPreferredSize(new Dimension(220, 166));
128
129     sequenceHolderPanel.add(scalePanelHolder, BorderLayout.NORTH);
130     sequenceHolderPanel.add(seqPanelHolder, BorderLayout.CENTER);
131     seqPanelHolder.add(vscroll, BorderLayout.EAST);
132     sequenceHolderPanel.add(annotationScroller, BorderLayout.SOUTH);
133
134     // jPanel3.add(secondaryPanelHolder, BorderLayout.SOUTH);
135     this.add(idPanelHolder, BorderLayout.WEST);
136     idPanelHolder.add(idSpaceFillerPanel1, BorderLayout.NORTH);
137     idPanelHolder.add(annotationSpaceFillerHolder, BorderLayout.SOUTH);
138     this.add(hscrollHolder, BorderLayout.SOUTH);
139     hscrollHolder.add(hscroll, BorderLayout.CENTER);
140     hscrollHolder.add(hscrollFillerPanel, BorderLayout.WEST);
141     this.add(sequenceHolderPanel, BorderLayout.CENTER);
142   }
143 }