/** * Copyright Copyright 2010-14 Simon Andrews * * This file is part of BamQC. * * BamQC 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. * * BamQC 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 BamQC; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * Changelog: * - Piero Dalle Pezze: Updated licenses, authors, added antialias * - Simon Andrews: Class creation. */ package uk.ac.babraham.BamQC.Dialogs; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Font; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.Insets; import java.awt.RenderingHints; import javax.swing.BorderFactory; import javax.swing.ImageIcon; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JTextField; import uk.ac.babraham.BamQC.BamQCApplication; /** * The Class BamQCTitlePanel. * @author Simon Andrews * @author Piero Dalle Pezze */ public class BamQCTitlePanel extends JPanel { private static final long serialVersionUID = 1L; /** * Provides a small panel which gives details of the BamQC version * and copyright. Used in both the welcome panel and the about dialog. */ public BamQCTitlePanel () { setLayout(new BorderLayout(5,1)); ImageIcon logo = new ImageIcon(ClassLoader.getSystemResource("uk/ac/babraham/BamQC/Resources/bamqc_icon_100.png")); JPanel logoPanel = new JPanel(); logoPanel.add(new JLabel("",logo,JLabel.CENTER)); logoPanel.setBorder(BorderFactory.createEmptyBorder(3, 3, 3, 3)); add(logoPanel,BorderLayout.WEST); JPanel c = new JPanel(); c.setLayout(new GridBagLayout()); GridBagConstraints constraints = new GridBagConstraints(); constraints.gridx=1; constraints.gridy=1; constraints.weightx = 1; constraints.weighty=1; constraints.insets = new Insets(3, 3, 0, 0); constraints.fill = GridBagConstraints.NONE; JLabel program = new SmoothJLabel("BamQC High Throughput Mapped Read QC Report",JLabel.CENTER); program.setFont(new Font("Dialog",Font.BOLD,18)); program.setForeground(new Color(200,0,0)); c.add(program,constraints); constraints.gridy++; JLabel version = new SmoothJLabel("Version: "+BamQCApplication.VERSION, JLabel.CENTER); version.setFont(new Font("Dialog",Font.BOLD,15)); version.setForeground(new Color(0,0,200)); c.add(version,constraints); constraints.gridy++; // Use a text field so they can copy this JTextField website = new JTextField(" www.bioinformatics.babraham.ac.uk/projects/ "); website.setFont(new Font("Dialog",Font.PLAIN,14)); website.setEditable(false); website.setBorder(null); website.setOpaque(false); website.setHorizontalAlignment(JTextField.CENTER); c.add(website,constraints); constraints.gridy++; JLabel copyright = new JLabel("<html>\u00a9 Simon Andrews, Pierre Lindenbaum, Brian Howard, <br>Phil Ewels, Bart Ailey, Piero Dalle Pezze 2011-16</html>", JLabel.CENTER); copyright.setFont(new Font("Dialog",Font.PLAIN,14)); c.add(copyright,constraints); constraints.gridy++; JLabel copyright2 = new JLabel("Picard BAM/SAM reader \u00a9The Broad Institute, 2013", JLabel.CENTER); copyright2.setFont(new Font("Dialog",Font.PLAIN,10)); c.add(copyright2,constraints); constraints.gridy++; JLabel copyright3 = new JLabel("BZip decompression \u00a9Matthew J. Francis, 2011", JLabel.CENTER); copyright3.setFont(new Font("Dialog",Font.PLAIN,10)); c.add(copyright3,constraints); constraints.gridy++; JLabel copyright4 = new JLabel("Base64 encoding \u00a9Robert Harder, 2012", JLabel.CENTER); copyright4.setFont(new Font("Dialog",Font.PLAIN,10)); c.add(copyright4,constraints); constraints.gridy++; JLabel copyright5 = new JLabel("Apache Commons (lang, math) \u00a9Apache Software Foundation, 2015", JLabel.CENTER); copyright5.setFont(new Font("Dialog",Font.PLAIN,10)); c.add(copyright5,constraints); constraints.gridy++; JLabel copyright6 = new JLabel("Apache log4j \u00a9Apache Software Foundation, 2012", JLabel.CENTER); copyright6.setFont(new Font("Dialog",Font.PLAIN,10)); c.add(copyright6,constraints); constraints.gridy++; JLabel copyright7 = new JLabel("JUnit \u00a9 JUnit Team, 2015", JLabel.CENTER); copyright7.setFont(new Font("Dialog",Font.PLAIN,10)); c.add(copyright7,constraints); constraints.gridy++; JLabel copyright8 = new JLabel("Hamcrest \u00a9 Hamcrest Team, 2012", JLabel.CENTER); copyright8.setFont(new Font("Dialog",Font.PLAIN,10)); c.add(copyright8,constraints); add(c,BorderLayout.CENTER); } /** * A JLabel with anti-aliasing enabled. Takes the same constructor * arguments as JLabel */ private class SmoothJLabel extends JLabel { private static final long serialVersionUID = 4036739763854114821L; /** * Creates a new label * * @param text The text * @param position The JLabel constant position for alignment */ public SmoothJLabel (String text, int position) { super(text,position); } /* (non-Javadoc) * @see javax.swing.JComponent#paintComponent(java.awt.Graphics) */ @Override public void paintComponent (Graphics g) { if (g instanceof Graphics2D) { ((Graphics2D)g).setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); } super.paintComponent(g); } } }