blob: f3ce5022e0dd97fa7c1a6fba15e195d3851e5a6f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
package uk.org.ury.frontend;
import java.awt.Color;
import java.awt.FlowLayout;
import javax.swing.BorderFactory;
import javax.swing.ImageIcon;
import javax.swing.JLabel;
import javax.swing.JPanel;
/**
* A banner, displaying a title, intended for use at the top of the
* frontend frame.
*
* @author Matt Windsor
*/
public class FrontendBanner extends JPanel
{
/**
*
*/
private static final long serialVersionUID = -3636933349004358394L;
private static final String TITLE_PREFIX = "<html><h1><font color=white>";
private static final String TITLE_SUFFIX = "</font></h1></html>";
private JLabel titleLabel;
/**
* Construct a new banner.
*
* @param title The initial title to display in the banner.
*/
public
FrontendBanner (String title)
{
setLayout (new FlowLayout (FlowLayout.LEFT));
setBackground (new Color (0, 0, 0));
JLabel logo = new JLabel (new ImageIcon (getClass ().getResource ("images/ury.png")));
titleLabel = new JLabel (TITLE_PREFIX + title + TITLE_SUFFIX);
titleLabel.setBorder (BorderFactory.createEmptyBorder (5, 15, 5, 5));
add (logo);
add (titleLabel);
}
/**
* Change the title displayed on the banner.
*
* @param title The new title to display.
*/
public void
setTitle (String title)
{
titleLabel.setText (TITLE_PREFIX + title + TITLE_SUFFIX);
}
}
|