Debian Codegraph @

uk/ac/babraham/FastQC/Dialogs/FastQCTitlePanel.java

raw symbols SCIP
1 /**
2 * Copyright Copyright 2010-17 Simon Andrews
3 *
4 * This file is part of FastQC.
5 *
6 * FastQC is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * FastQC is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with FastQC; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20 package uk.ac.babraham.FastQC.Dialogs;
21
22 import java.awt.BorderLayout;
23 import java.awt.Color;
24 import java.awt.Font;
25 import java.awt.Graphics;
26 import java.awt.Graphics2D;
27 import java.awt.GridBagConstraints;
28 import java.awt.GridBagLayout;
29 import java.awt.Insets;
30 import java.awt.RenderingHints;
31
32 import javax.swing.BorderFactory;
33 import javax.swing.ImageIcon;
34 import javax.swing.JLabel;
35 import javax.swing.JPanel;
36 import javax.swing.JTextField;
37
38 import uk.ac.babraham.FastQC.FastQCApplication;
39
40 /**
41 * The Class SeqMonkTitlePanel.
42 */
43
44 public class FastQCTitlePanel extends JPanel {
45 private static final long serialVersionUID = 1L;
46
47 /**
48 * Provides a small panel which gives details of the FastQC version
49 * and copyright. Used in both the welcome panel and the about dialog.
50 */
51 public FastQCTitlePanel () {
52 setLayout(new BorderLayout(5,1));
53
54 ImageIcon logo = new ImageIcon(ClassLoader.getSystemResource("uk/ac/babraham/FastQC/Resources/fastqc_icon_100.png"));
55 JPanel logoPanel = new JPanel();
56 logoPanel.add(new JLabel("",logo,JLabel.CENTER));
57 logoPanel.setBorder(BorderFactory.createEmptyBorder(3, 3, 3, 3));
58 add(logoPanel,BorderLayout.WEST);
59 JPanel c = new JPanel();
60 c.setLayout(new GridBagLayout());
61
62 GridBagConstraints constraints = new GridBagConstraints();
63 constraints.gridx=1;
64 constraints.gridy=1;
65 constraints.weightx = 1;
66 constraints.weighty=1;
67 constraints.insets = new Insets(3, 3, 0, 0);
68 constraints.fill = GridBagConstraints.NONE;
69
70 JLabel program = new SmoothJLabel("FastQC High Throughput Sequence QC Report",JLabel.CENTER);
71 program.setFont(new Font("Dialog",Font.BOLD,18));
72 program.setForeground(new Color(200,0,0));
73 c.add(program,constraints);
74
75 constraints.gridy++;
76 JLabel version = new SmoothJLabel("Version: "+FastQCApplication.VERSION, JLabel.CENTER);
77 version.setFont(new Font("Dialog",Font.BOLD,15));
78 version.setForeground(new Color(0,0,200));
79 c.add(version,constraints);
80
81 constraints.gridy++;
82 // Use a text field so they can copy this
83 JTextField website = new JTextField(" www.bioinformatics.babraham.ac.uk/projects/ ");
84 website.setFont(new Font("Dialog",Font.PLAIN,14));
85 website.setEditable(false);
86 website.setBorder(null);
87 website.setOpaque(false);
88 website.setHorizontalAlignment(JTextField.CENTER);
89 c.add(website,constraints);
90 constraints.gridy++;
91
92 JLabel copyright = new JLabel("\u00a9 Simon Andrews, Pierre Lindenbaum, Brian Howard, Phil Ewels 2011-22,", JLabel.CENTER);
93 copyright.setFont(new Font("Dialog",Font.PLAIN,14));
94 c.add(copyright,constraints);
95 constraints.gridy++;
96
97 JLabel copyright2 = new JLabel("HTSJDK BAM/SAM reader v2.24.1 from Samtools 2022", JLabel.CENTER);
98 copyright2.setFont(new Font("Dialog",Font.PLAIN,10));
99 c.add(copyright2,constraints);
100 constraints.gridy++;
101
102 JLabel copyright3 = new JLabel("BZip decompression \u00a9Matthew J. Francis, 2011", JLabel.CENTER);
103 copyright3.setFont(new Font("Dialog",Font.PLAIN,10));
104 c.add(copyright3,constraints);
105 constraints.gridy++;
106
107 JLabel copyright4 = new JLabel("Base64 encoding \u00a9Robert Harder, 2012", JLabel.CENTER);
108 copyright4.setFont(new Font("Dialog",Font.PLAIN,10));
109 c.add(copyright4,constraints);
110 constraints.gridy++;
111
112 JLabel copyright5 = new JLabel("Java HDF5 reader \u00a9ETH, CISD and SIS, 2007-14", JLabel.CENTER);
113 copyright5.setFont(new Font("Dialog",Font.PLAIN,10));
114 c.add(copyright5,constraints);
115
116 add(c,BorderLayout.CENTER);
117 }
118
119 /**
120 * A JLabel with anti-aliasing enabled. Takes the same constructor
121 * arguments as JLabel
122 */
123 private class SmoothJLabel extends JLabel {
124
125 /**
126 * Creates a new label
127 *
128 * @param text The text
129 * @param position The JLabel constant position for alignment
130 */
131 public SmoothJLabel (String text, int position) {
132 super(text,position);
133 }
134
135 /* (non-Javadoc)
136 * @see javax.swing.JComponent#paintComponent(java.awt.Graphics)
137 */
138 public void paintComponent (Graphics g) {
139 if (g instanceof Graphics2D) {
140 ((Graphics2D)g).setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
141 }
142 super.paintComponent(g);
143 }
144
145 }
146
147 }