~ubuntu-branches/ubuntu/saucy/fastqc/saucy-proposed

« back to all changes in this revision

Viewing changes to uk/ac/babraham/FastQC/Dialogs/FastQCTitlePanel.java

  • Committer: Package Import Robot
  • Author(s): Andreas Tille
  • Date: 2012-11-20 13:38:32 UTC
  • Revision ID: package-import@ubuntu.com-20121120133832-psohzlsak64g7bdy
Tags: upstream-0.10.1+dfsg
ImportĀ upstreamĀ versionĀ 0.10.1+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/**
 
2
 * Copyright Copyright 2010-12 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
 */package uk.ac.babraham.FastQC.Dialogs;
 
20
 
 
21
import java.awt.BorderLayout;
 
22
import java.awt.Color;
 
23
import java.awt.Font;
 
24
import java.awt.Graphics;
 
25
import java.awt.Graphics2D;
 
26
import java.awt.GridBagConstraints;
 
27
import java.awt.GridBagLayout;
 
28
import java.awt.Insets;
 
29
import java.awt.RenderingHints;
 
30
 
 
31
import javax.swing.BorderFactory;
 
32
import javax.swing.ImageIcon;
 
33
import javax.swing.JLabel;
 
34
import javax.swing.JPanel;
 
35
import javax.swing.JTextField;
 
36
 
 
37
import uk.ac.babraham.FastQC.FastQCApplication;
 
38
 
 
39
/**
 
40
 * The Class SeqMonkTitlePanel.
 
41
 */
 
42
public class FastQCTitlePanel extends JPanel {
 
43
 
 
44
        /**
 
45
         * Provides a small panel which gives details of the FastQC version
 
46
         * and copyright.  Used in both the welcome panel and the about dialog.
 
47
         */
 
48
        public FastQCTitlePanel () {
 
49
                setLayout(new BorderLayout(5,1));
 
50
 
 
51
                ImageIcon logo = new ImageIcon(ClassLoader.getSystemResource("uk/ac/babraham/FastQC/Resources/fastqc_icon_100.png"));
 
52
                JPanel logoPanel = new JPanel();
 
53
                logoPanel.add(new JLabel("",logo,JLabel.CENTER));
 
54
                logoPanel.setBorder(BorderFactory.createEmptyBorder(3, 3, 3, 3));
 
55
                add(logoPanel,BorderLayout.WEST);
 
56
                JPanel c = new JPanel();
 
57
                c.setLayout(new GridBagLayout());
 
58
 
 
59
                GridBagConstraints constraints = new GridBagConstraints();
 
60
                constraints.gridx=1;
 
61
                constraints.gridy=1;
 
62
                constraints.weightx = 1;
 
63
                constraints.weighty=1;
 
64
                constraints.insets = new Insets(3, 3, 0, 0);
 
65
                constraints.fill = GridBagConstraints.NONE;
 
66
 
 
67
                JLabel program = new SmoothJLabel("FastQC High Throughput Sequence QC Report",JLabel.CENTER);
 
68
                program.setFont(new Font("Dialog",Font.BOLD,18));
 
69
                program.setForeground(new Color(200,0,0));
 
70
                c.add(program,constraints);
 
71
 
 
72
                constraints.gridy++;
 
73
                JLabel version = new SmoothJLabel("Version: "+FastQCApplication.VERSION, JLabel.CENTER);
 
74
                version.setFont(new Font("Dialog",Font.BOLD,15));
 
75
                version.setForeground(new Color(0,0,200));
 
76
                c.add(version,constraints);
 
77
 
 
78
                constraints.gridy++;
 
79
                // Use a text field so they can copy this
 
80
                JTextField website = new JTextField(" www.bioinformatics.babraham.ac.uk/projects/ ");
 
81
                website.setFont(new Font("Dialog",Font.PLAIN,14));
 
82
                website.setEditable(false);
 
83
                website.setBorder(null);
 
84
                website.setOpaque(false);
 
85
                website.setHorizontalAlignment(JTextField.CENTER);
 
86
                c.add(website,constraints);
 
87
                constraints.gridy++;
 
88
 
 
89
                JLabel copyright = new JLabel("\u00a9 Simon Andrews, Babraham Bioinformatics, 2011", JLabel.CENTER);
 
90
                copyright.setFont(new Font("Dialog",Font.PLAIN,14));
 
91
                c.add(copyright,constraints);
 
92
                constraints.gridy++;
 
93
                
 
94
                JLabel copyright2 = new JLabel("Picard BAM/SAM reader \u00a9The Broad Institute, 2009", JLabel.CENTER);
 
95
                copyright2.setFont(new Font("Dialog",Font.PLAIN,10));
 
96
                c.add(copyright2,constraints);
 
97
                constraints.gridy++;
 
98
                
 
99
                JLabel copyright3 = new JLabel("BZip decompression \u00a9Matthew J. Francis, 2011", JLabel.CENTER);
 
100
                copyright3.setFont(new Font("Dialog",Font.PLAIN,10));
 
101
                c.add(copyright3,constraints);
 
102
 
 
103
                add(c,BorderLayout.CENTER);
 
104
        }
 
105
        
 
106
        /**
 
107
         * A JLabel with anti-aliasing enabled.  Takes the same constructor
 
108
         * arguments as JLabel
 
109
         */
 
110
        private class SmoothJLabel extends JLabel {
 
111
                
 
112
                /**
 
113
                 * Creates a new label
 
114
                 * 
 
115
                 * @param text The text
 
116
                 * @param position The JLabel constant position for alignment
 
117
                 */
 
118
                public SmoothJLabel (String text, int position) {
 
119
                        super(text,position);
 
120
                }
 
121
                
 
122
                /* (non-Javadoc)
 
123
                 * @see javax.swing.JComponent#paintComponent(java.awt.Graphics)
 
124
                 */
 
125
                public void paintComponent (Graphics g) {
 
126
                        if (g instanceof Graphics2D) {
 
127
                                ((Graphics2D)g).setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
 
128
                        }
 
129
                        super.paintComponent(g);
 
130
                }
 
131
 
 
132
        }
 
133
        
 
134
}