/* * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$) * Copyright (C) $$Year-Rel$$ The Jalview Authors * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 * of the License, or (at your option) any later version. * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Jalview. If not, see . * The Jalview Authors are detailed in the 'AUTHORS' file. */ package jalview.jbgui; import jalview.bin.Jalview; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Dimension; import javax.swing.BorderFactory; import javax.swing.ButtonGroup; import javax.swing.JComponent; import javax.swing.JPanel; import javax.swing.JScrollBar; import javax.swing.JScrollPane; import javax.swing.border.Border; import javax.swing.plaf.ScrollBarUI; @SuppressWarnings("serial") public class GAlignmentPanel extends JPanel { protected JScrollBar vscroll;// = new JScrollBar(); protected JScrollBar hscroll;// = new JScrollBar(); BorderLayout borderLayout1;// = new BorderLayout(); BorderLayout borderLayout3;// = new BorderLayout(); BorderLayout borderLayout5;// = new BorderLayout(); BorderLayout borderLayout6;// = new BorderLayout(); ButtonGroup buttonGroup1;// = new ButtonGroup(); BorderLayout borderLayout7;// = new BorderLayout(); BorderLayout borderLayout10;// = new BorderLayout(); BorderLayout borderLayout11;// = new BorderLayout(); public JScrollPane annotationScroller;// = new JScrollPane(); Border border1; BorderLayout borderLayout4;// = new BorderLayout(); static JPanel newJPanel() { // BH 2019 JPanel p = new JPanel(); // leaving this in, as it prevents // the checkerboard business, despite how // funky that looks. Remove if you want to. p.setBackground(Color.white); return p; } static { System.out.println("GAP 1 static "); } protected JPanel sequenceHolderPanel;// = new JPanel(); protected JPanel seqPanelHolder;// = new JPanel(); protected JPanel scalePanelHolder;// = new JPanel(); protected JPanel idPanelHolder;// = new JPanel(); protected JPanel idSpaceFillerPanel1;// = new JPanel(); public JPanel annotationSpaceFillerHolder;// = new JPanel(); protected JPanel hscrollFillerPanel;// = new JPanel(); JPanel hscrollHolder;// = new JPanel(); static { System.out.println("GAP 2 static "); } public GAlignmentPanel() { System.out.println("GAP 3a"); System.out.println(Jalview.isHeadlessMode()); try { vscroll = newScrollBar(); } catch (Throwable t) { t.printStackTrace(); System.exit(1); } hscroll = newScrollBar(); System.out.println("GAP 3b"); borderLayout1 = new BorderLayout(); borderLayout3 = new BorderLayout(); borderLayout5 = new BorderLayout(); borderLayout6 = new BorderLayout(); buttonGroup1 = new ButtonGroup(); borderLayout7 = new BorderLayout(); borderLayout10 = new BorderLayout(); borderLayout11 = new BorderLayout(); System.out.println("GAP 3c"); annotationScroller = new JScrollPane() { @Override public void updateUI() { System.out.println("JScrollPane updateUI"); } @Override public JScrollBar createVerticalScrollBar() { return newScrollBar(); } @Override public JScrollBar createHorizontalScrollBar() { return newScrollBar(); } }; System.out.println("GAP 3d"); borderLayout4 = new BorderLayout(); System.out.println("GAP 3e"); sequenceHolderPanel = newJPanel(); seqPanelHolder = newJPanel(); scalePanelHolder = newJPanel(); idPanelHolder = newJPanel(); idSpaceFillerPanel1 = newJPanel(); annotationSpaceFillerHolder = newJPanel(); hscrollFillerPanel = newJPanel(); hscrollHolder = newJPanel(); System.out.println("GAP 3r"); try { System.out.println("GAP 3 "); jbInit(); System.out.println("GAP 4 "); } catch (Exception e) { e.printStackTrace(); } } private JScrollBar newScrollBar() { return new JScrollBar() { /** * Overrides JComponent.updateUI. * * @see JComponent#updateUI */ @Override public void updateUI() { System.out.println("JScrollBar.updateUI"); setUI(new ScrollBarUI() { }); } @Override public void setUI(ScrollBarUI ui) { System.out.println("JScrollBar.setUI"); // setUI(ui); } }; } private void jbInit() throws Exception { // annotationScroller.setBackground(Color.white); // BH 2019 border1 = BorderFactory.createLineBorder(Color.gray, 1); idPanelHolder.setBorder(null); idPanelHolder.setPreferredSize(new Dimension(70, 10)); this.setLayout(borderLayout7); sequenceHolderPanel .setMaximumSize(new Dimension(2147483647, 2147483647)); sequenceHolderPanel.setMinimumSize(new Dimension(150, 150)); sequenceHolderPanel.setPreferredSize(new Dimension(150, 150)); sequenceHolderPanel.setLayout(borderLayout3); seqPanelHolder.setLayout(borderLayout1); scalePanelHolder.setBackground(Color.white); scalePanelHolder.setMinimumSize(new Dimension(10, 80)); scalePanelHolder.setPreferredSize(new Dimension(10, 30)); scalePanelHolder.setLayout(borderLayout6); idPanelHolder.setLayout(borderLayout5); idSpaceFillerPanel1.setBackground(Color.white); idSpaceFillerPanel1.setPreferredSize(new Dimension(10, 30)); idSpaceFillerPanel1.setLayout(borderLayout11); annotationSpaceFillerHolder.setBackground(Color.white); annotationSpaceFillerHolder.setPreferredSize(new Dimension(10, 80)); annotationSpaceFillerHolder.setLayout(borderLayout4); hscroll.setOrientation(JScrollBar.HORIZONTAL); hscrollHolder.setLayout(borderLayout10); hscrollFillerPanel.setBackground(Color.white); hscrollFillerPanel.setPreferredSize(new Dimension(70, 10)); hscrollHolder.setBackground(Color.white); annotationScroller.setBorder(null); annotationScroller.setBackground(Color.BLUE); annotationScroller.setPreferredSize(new Dimension(10, 80)); this.setPreferredSize(new Dimension(220, 166)); sequenceHolderPanel.add(scalePanelHolder, BorderLayout.NORTH); sequenceHolderPanel.add(seqPanelHolder, BorderLayout.CENTER); seqPanelHolder.add(vscroll, BorderLayout.EAST); sequenceHolderPanel.add(annotationScroller, BorderLayout.SOUTH); // jPanel3.add(secondaryPanelHolder, BorderLayout.SOUTH); this.add(idPanelHolder, BorderLayout.WEST); idPanelHolder.add(idSpaceFillerPanel1, BorderLayout.NORTH); idPanelHolder.add(annotationSpaceFillerHolder, BorderLayout.SOUTH); this.add(hscrollHolder, BorderLayout.SOUTH); hscrollHolder.add(hscroll, BorderLayout.CENTER); hscrollHolder.add(hscrollFillerPanel, BorderLayout.WEST); this.add(sequenceHolderPanel, BorderLayout.CENTER); } }