blob: 54e33dd19ea0c034a8a944108e1534bc43f8301d (
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
|
/**
*
*/
package uk.org.ury.show.viewer;
import java.awt.event.KeyEvent;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JList;
import uk.org.ury.frontend.FrontendPanel;
import uk.org.ury.frontend.exceptions.UICreationFailureException;
import uk.org.ury.show.ShowChannel;
/**
* A panel displaying channel information.
*
* @author Matt Windsor.
*/
public class ChannelPanel extends FrontendPanel
{
/**
*
*/
private static final long serialVersionUID = 897125684384350966L;
/* Components created and exposed by the XML engine. */
private JLabel channelName;
private JList itemList;
private JButton playButton;
private JButton pauseButton;
private JButton stopButton;
/**
* Construct a new ChannelPanel.
*
* This constructor reads the channel panel layout from the
* XML manifest "channel_panel.xml" in the same directory as
* this class file.
*
* @param number The number of the channel.
*
* @param channel The channel whose data the ChannelPanel is viewing.
*
* @throws UICreationFailureException if the UI creation fails.
*/
public
ChannelPanel (int number, ShowChannel channel)
throws UICreationFailureException
{
super ("channel_panel.xml", null);
// Tweak buttons to add function key mnemonics, if function keys are available.
if (number <= 3)
{
int base = (number - 1) * 4;
playButton.setText ("Play (F" + (base + 1) + ")");
playButton.setMnemonic (KeyEvent.VK_F1 + (base ));
playButton.setDisplayedMnemonicIndex (7);
pauseButton.setText ("Stop (F" + (base + 2) + ")");
pauseButton.setMnemonic (KeyEvent.VK_F2 + (base ));
pauseButton.setDisplayedMnemonicIndex (7);
stopButton.setText ("Pause (F" + (base + 3) + ")");
stopButton.setMnemonic (KeyEvent.VK_F3 + (base ));
stopButton.setDisplayedMnemonicIndex (8);
}
// Test stuff
itemList.setModel (channel);
channelName.setText ("Channel " + number);
}
}
|