@Override
	public void serialEvent(SerialState state) {
		switch(state)
		{
		case Connected:
			shell.setText(Messages.MainWin_33 + FkManager.getInstance().getBanner());
			setSystrayIconTip(Messages.MainWin_33 + FkManager.getInstance().getBanner());

			animation.setVisible(false);
			animation.setPlaying(false);

			btnConnect.setText(Messages.MainWin_34);
			btnConnect.setEnabled(true);

			//Should we hide?
			if( prefs.getBoolean(PREF_AUTOHIDE, false) == true)
			{
				hideToTray();
			}

			addThisFkTab();
			addAccountsTab();
			

			
			tabFolder.setSelection(tbtmAccounts);

			updateAccountList();
			txtFilter.setFocus();

			//Update icons for systray and window
			shell.setImage( iconProgramOnline );
			trayIcon.setImage( iconSystrayOnline );

			int numAccounts=FkManager.getInstance().getList().size();
			if( numAccounts>0 && prefs.getBoolean( PREF_SHOW_ACCOUNTS_READY_NOTICE, true) )
			{

				class TrayIconMessageTask implements Runnable
				{
					private String msg;
					public TrayIconMessageTask(String _msg)
					{
						msg = _msg;
					}
					public void run()
					{
						trayIcon.displayMessage("FinalKey", msg, //$NON-NLS-1$ //$NON-NLS-2$
								TrayIcon.MessageType.INFO);
					}
				}

				new Thread( new TrayIconMessageTask(numAccounts +" "+ (( numAccounts >1)?Messages.MainWin_1:Messages.MainWin_2)) ).start(); //$NON-NLS-1$

			}

		//	log(Messages.MainWin_40);

			break;
		case Connecting:
			shell.setText(Messages.MainWin_41);
			animation.setVisible(true);
			animation.setPlaying(true);

			txtPsw.setEnabled(false);
			txtDev.setEnabled(false);
			btnConnect.setEnabled(false);

			lblPort.setEnabled(false);
			lblPassword.setEnabled(false);
			break;
		case Disconnected:
			setSystrayIconTip("The Final Key - Not Connected"); //$NON-NLS-1$

			fkSerial=null;
			animation.setVisible(false);
			animation.setPlaying(false);

			remAccountsTab();
			remThisFkTab();

			tabFolder.setSelection(0);

			shell.setText(Messages.MainWin_42);
			btnConnect.setText(Messages.MainWin_43);

			btnConnect.setEnabled(true);

			lblPort.setEnabled(true);
			lblPassword.setEnabled(true);
			txtPsw.setEnabled(true);
			txtPsw.setFocus();
			txtDev.setEnabled(true);

			cmpConnect.update();

			clearSystray(true);

			//Update icons for systray and window
			shell.setImage( iconProgramOffline );
			trayIcon.setImage( iconSystrayOffline );
			break;

		case Working:
			animation.setPlaying(false);
			animation.setVisible(false);
			break;

		default:
			break;
		}
		cmpConnect.layout();
	}