@Override public void actionPerformed(ActionEvent event){
switch (event.getActionCommand()) {
case NEW_CHANNEL:
    addChannel(new Channel("New Channel"));
  break;
case COPY_CHANNEL:
Channel selected=getSelectedChannel();
if (selected != null) {
addChannel(selected.copyOf());
}
break;
case DELETE_CHANNEL:
Channel toDelete=getSelectedChannel();
if (toDelete != null) {
int choice=JOptionPane.showConfirmDialog(ChannelController.this,"Do you want to delete this channel?","Delete Channel?",JOptionPane.YES_NO_OPTION,JOptionPane.WARNING_MESSAGE);
if (choice == JOptionPane.YES_OPTION) {
mChannelModel.removeChannel(toDelete);
}
}
break;
default :
break;
}
}

@ Override public void actionPerformed ( ActionEvent event ) { switch ( event . getActionCommand ( ) ) { case NEW_CHANNEL : addChannel ( new Channel ( "New Channel" ) ) ; break ; case COPY_CHANNEL : Channel selected = getSelectedChannel ( ) ; if ( selected != null ) { addChannel ( selected . copyOf ( ) ) ; } break ; case DELETE_CHANNEL : Channel toDelete = getSelectedChannel ( ) ; if ( toDelete != null ) { int choice = JOptionPane . showConfirmDialog ( ChannelController . this , "Do you want to delete this channel?" , "Delete Channel?" , JOptionPane . YES_NO_OPTION , JOptionPane . WARNING_MESSAGE ) ; if ( choice == JOptionPane . YES_OPTION ) { mChannelModel . removeChannel ( toDelete ) ; } } break ; default : break ; } }
responds to new , copy and delete channel button invocations
