Merge branch 'develop' into feature/JAL-3416_update_to_flatlaf_3.1.1_with_unpacked_na...
[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   static JPanel newJPanel()
64   { // 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
75   protected JPanel seqPanelHolder = newJPanel();
76
77   protected JPanel scalePanelHolder = newJPanel();
78
79   protected JPanel idPanelHolder = newJPanel();
80
81   protected JPanel idSpaceFillerPanel1 = newJPanel();
82
83   public JPanel annotationSpaceFillerHolder = newJPanel();
84
85   protected JPanel hscrollFillerPanel = newJPanel();
86
87   JPanel hscrollHolder = newJPanel();
88
89   public GAlignmentPanel()
90   {
91     try
92     {
93       jbInit();
94     } catch (Exception e)
95     {
96       e.printStackTrace();
97     }
98   }
99
100   private void jbInit() throws Exception
101   {
102     // annotationScroller.setBackground(Color.white); // BH 2019
103
104     border1 = BorderFactory.createLineBorder(Color.gray, 1);
105     idPanelHolder.setBorder(null);
106     idPanelHolder.setPreferredSize(new Dimension(70, 10));
107     this.setLayout(borderLayout7);
108     sequenceHolderPanel
109             .setMaximumSize(new Dimension(2147483647, 2147483647));
110     sequenceHolderPanel.setMinimumSize(new Dimension(150, 150));
111     sequenceHolderPanel.setPreferredSize(new Dimension(150, 150));
112     sequenceHolderPanel.setLayout(borderLayout3);
113     seqPanelHolder.setLayout(borderLayout1);
114     scalePanelHolder.setBackground(Color.white);
115     scalePanelHolder.setMinimumSize(new Dimension(10, 80));
116     scalePanelHolder.setPreferredSize(new Dimension(10, 30));
117     scalePanelHolder.setLayout(borderLayout6);
118     idPanelHolder.setLayout(borderLayout5);
119     idSpaceFillerPanel1.setBackground(Color.white);
120     idSpaceFillerPanel1.setPreferredSize(new Dimension(10, 30));
121     idSpaceFillerPanel1.setLayout(borderLayout11);
122     annotationSpaceFillerHolder.setBackground(Color.white);
123     annotationSpaceFillerHolder.setPreferredSize(new Dimension(10, 80));
124     annotationSpaceFillerHolder.setLayout(borderLayout4);
125     hscroll.setOrientation(JScrollBar.HORIZONTAL);
126     hscrollHolder.setLayout(borderLayout10);
127     hscrollFillerPanel.setBackground(Color.white);
128     hscrollFillerPanel.setPreferredSize(new Dimension(70, 10));
129     hscrollHolder.setBackground(Color.white);
130     annotationScroller.setBorder(null);
131     annotationScroller.setPreferredSize(new Dimension(10, 80));
132     this.setPreferredSize(new Dimension(220, 166));
133
134     sequenceHolderPanel.add(scalePanelHolder, BorderLayout.NORTH);
135     sequenceHolderPanel.add(seqPanelHolder, BorderLayout.CENTER);
136     seqPanelHolder.add(vscroll, BorderLayout.EAST);
137     sequenceHolderPanel.add(annotationScroller, BorderLayout.SOUTH);
138
139     // jPanel3.add(secondaryPanelHolder, BorderLayout.SOUTH);
140     this.add(idPanelHolder, BorderLayout.WEST);
141     idPanelHolder.add(idSpaceFillerPanel1, BorderLayout.NORTH);
142     idPanelHolder.add(annotationSpaceFillerHolder, BorderLayout.SOUTH);
143     this.add(hscrollHolder, BorderLayout.SOUTH);
144     hscrollHolder.add(hscroll, BorderLayout.CENTER);
145     hscrollHolder.add(hscrollFillerPanel, BorderLayout.WEST);
146     this.add(sequenceHolderPanel, BorderLayout.CENTER);
147   }
148 }