2 * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
3 * Copyright (C) $$Year-Rel$$ The Jalview Authors
5 * This file is part of Jalview.
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.
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.
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.
21 package jalview.jbgui;
23 import jalview.bin.Jalview;
25 import java.awt.BorderLayout;
26 import java.awt.Color;
27 import java.awt.Dimension;
29 import javax.swing.BorderFactory;
30 import javax.swing.ButtonGroup;
31 import javax.swing.JComponent;
32 import javax.swing.JPanel;
33 import javax.swing.JScrollBar;
34 import javax.swing.JScrollPane;
35 import javax.swing.border.Border;
36 import javax.swing.plaf.ScrollBarUI;
38 @SuppressWarnings("serial")
39 public class GAlignmentPanel extends JPanel
41 protected JScrollBar vscroll;// = new JScrollBar();
43 protected JScrollBar hscroll;// = new JScrollBar();
45 BorderLayout borderLayout1;// = new BorderLayout();
47 BorderLayout borderLayout3;// = new BorderLayout();
49 BorderLayout borderLayout5;// = new BorderLayout();
51 BorderLayout borderLayout6;// = new BorderLayout();
53 ButtonGroup buttonGroup1;// = new ButtonGroup();
55 BorderLayout borderLayout7;// = new BorderLayout();
57 BorderLayout borderLayout10;// = new BorderLayout();
59 BorderLayout borderLayout11;// = new BorderLayout();
61 public JScrollPane annotationScroller;// = new JScrollPane();
65 BorderLayout borderLayout4;// = new BorderLayout();
68 static JPanel newJPanel() { // BH 2019
69 JPanel p = new JPanel();
70 // leaving this in, as it prevents
71 // the checkerboard business, despite how
72 // funky that looks. Remove if you want to.
73 p.setBackground(Color.white);
79 System.out.println("GAP 1 static ");
82 protected JPanel sequenceHolderPanel;// = new JPanel();
84 protected JPanel seqPanelHolder;// = new JPanel();
86 protected JPanel scalePanelHolder;// = new JPanel();
88 protected JPanel idPanelHolder;// = new JPanel();
90 protected JPanel idSpaceFillerPanel1;// = new JPanel();
92 public JPanel annotationSpaceFillerHolder;// = new JPanel();
94 protected JPanel hscrollFillerPanel;// = new JPanel();
96 JPanel hscrollHolder;// = new JPanel();
100 System.out.println("GAP 2 static ");
104 public GAlignmentPanel()
107 System.out.println("GAP 3a");
109 System.out.println(Jalview.isHeadlessMode());
113 vscroll = newScrollBar();
114 } catch (Throwable t)
120 hscroll = newScrollBar();
122 System.out.println("GAP 3b");
124 borderLayout1 = new BorderLayout();
126 borderLayout3 = new BorderLayout();
128 borderLayout5 = new BorderLayout();
130 borderLayout6 = new BorderLayout();
132 buttonGroup1 = new ButtonGroup();
134 borderLayout7 = new BorderLayout();
136 borderLayout10 = new BorderLayout();
138 borderLayout11 = new BorderLayout();
140 System.out.println("GAP 3c");
141 annotationScroller = new JScrollPane() {
144 public void updateUI() {
145 System.out.println("JScrollPane updateUI");
149 public JScrollBar createVerticalScrollBar()
151 return newScrollBar();
155 public JScrollBar createHorizontalScrollBar()
157 return newScrollBar();
162 System.out.println("GAP 3d");
164 borderLayout4 = new BorderLayout();
166 System.out.println("GAP 3e");
167 sequenceHolderPanel = newJPanel();
169 seqPanelHolder = newJPanel();
171 scalePanelHolder = newJPanel();
173 idPanelHolder = newJPanel();
175 idSpaceFillerPanel1 = newJPanel();
177 annotationSpaceFillerHolder = newJPanel();
179 hscrollFillerPanel = newJPanel();
181 hscrollHolder = newJPanel();
183 System.out.println("GAP 3r");
188 System.out.println("GAP 3 ");
192 System.out.println("GAP 4 ");
194 } catch (Exception e)
200 private JScrollBar newScrollBar()
202 return new JScrollBar()
206 * Overrides <code>JComponent.updateUI</code>.
208 * @see JComponent#updateUI
211 public void updateUI()
214 System.out.println("JScrollBar.updateUI");
215 setUI(new ScrollBarUI()
222 public void setUI(ScrollBarUI ui)
224 System.out.println("JScrollBar.setUI");
230 private void jbInit() throws Exception
232 // annotationScroller.setBackground(Color.white); // BH 2019
234 border1 = BorderFactory.createLineBorder(Color.gray, 1);
235 idPanelHolder.setBorder(null);
236 idPanelHolder.setPreferredSize(new Dimension(70, 10));
237 this.setLayout(borderLayout7);
239 .setMaximumSize(new Dimension(2147483647, 2147483647));
240 sequenceHolderPanel.setMinimumSize(new Dimension(150, 150));
241 sequenceHolderPanel.setPreferredSize(new Dimension(150, 150));
242 sequenceHolderPanel.setLayout(borderLayout3);
243 seqPanelHolder.setLayout(borderLayout1);
244 scalePanelHolder.setBackground(Color.white);
245 scalePanelHolder.setMinimumSize(new Dimension(10, 80));
246 scalePanelHolder.setPreferredSize(new Dimension(10, 30));
247 scalePanelHolder.setLayout(borderLayout6);
248 idPanelHolder.setLayout(borderLayout5);
249 idSpaceFillerPanel1.setBackground(Color.white);
250 idSpaceFillerPanel1.setPreferredSize(new Dimension(10, 30));
251 idSpaceFillerPanel1.setLayout(borderLayout11);
252 annotationSpaceFillerHolder.setBackground(Color.white);
253 annotationSpaceFillerHolder.setPreferredSize(new Dimension(10, 80));
254 annotationSpaceFillerHolder.setLayout(borderLayout4);
255 hscroll.setOrientation(JScrollBar.HORIZONTAL);
256 hscrollHolder.setLayout(borderLayout10);
257 hscrollFillerPanel.setBackground(Color.white);
258 hscrollFillerPanel.setPreferredSize(new Dimension(70, 10));
259 hscrollHolder.setBackground(Color.white);
260 annotationScroller.setBorder(null);
261 annotationScroller.setBackground(Color.BLUE);
262 annotationScroller.setPreferredSize(new Dimension(10, 80));
263 this.setPreferredSize(new Dimension(220, 166));
265 sequenceHolderPanel.add(scalePanelHolder, BorderLayout.NORTH);
266 sequenceHolderPanel.add(seqPanelHolder, BorderLayout.CENTER);
267 seqPanelHolder.add(vscroll, BorderLayout.EAST);
268 sequenceHolderPanel.add(annotationScroller, BorderLayout.SOUTH);
270 // jPanel3.add(secondaryPanelHolder, BorderLayout.SOUTH);
271 this.add(idPanelHolder, BorderLayout.WEST);
272 idPanelHolder.add(idSpaceFillerPanel1, BorderLayout.NORTH);
273 idPanelHolder.add(annotationSpaceFillerHolder, BorderLayout.SOUTH);
274 this.add(hscrollHolder, BorderLayout.SOUTH);
275 hscrollHolder.add(hscroll, BorderLayout.CENTER);
276 hscrollHolder.add(hscrollFillerPanel, BorderLayout.WEST);
277 this.add(sequenceHolderPanel, BorderLayout.CENTER);