public void mouseClicked(MouseEvent arg0) {
String streamToAdd = JOptionPane.showInputDialog(frmStreamtrackerV, "Enter the name of the channel you'd like to track:");
// Do not attempt to add invalid streams
if (streamToAdd == null || streamToAdd == "") return;
if (streams.contains(new Stream(streamToAdd))) return;
// Get the correct location to add the stream
int i;
for(i = 0; i < streams.size() && streamToAdd.toLowerCase().compareTo(streams.get(i).getChannel().toLowerCase()) > 0; i++) { }
if (i == streams.size()) streams.add(new Stream(streamToAdd));
else streams.add(i, new Stream(streamToAdd));
// Refresh the newly-added stream, update the table of information, then repaint the window
streams.get(i).refresh();
updateTable();
frmStreamtrackerV.validate();
frmStreamtrackerV.repaint();
}
});
// Set the properties for the delete stream button
btnDeleteStream = new JButton("Delete stream");
btnDeleteStream.setFont(new Font("Tahoma", Font.PLAIN, 11));
btnDeleteStream.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent arg0) {
String streamToRemove = JOptionPane.showInputDialog(frmStreamtrackerV, "Enter the name of the channel you'd like to stop tracking:");
Stream r = new Stream(streamToRemove);
// Do not remove invalid streams
if (streamToRemove == null || streamToRemove == "" || !streams.contains(r))
{
return;