protected void createContents() {


		shell = new Shell();
		shell.setImage( iconProgramOffline ); //$NON-NLS-1$
		shell.setSize(711, 655);

		prefs = Preferences.userNodeForPackage(this.getClass());

		FkManager.getInstance().sortById( prefs.getBoolean(PREF_SORT_BY_ID_KEY, false) );

		mySelf = this;
		shell.setLayout(new FillLayout(SWT.HORIZONTAL));

		tabFolder = new TabFolder(shell, SWT.NONE);
		tabFolder.setBackground(SWTResourceManager.getColor(SWT.COLOR_WIDGET_LIGHT_SHADOW));

		TabItem tbtmConnection = new TabItem(tabFolder, SWT.NONE);
		tbtmConnection.setText(Messages.MainWin_12);

		cmpConnect = new Composite(tabFolder, SWT.BORDER);
		tbtmConnection.setControl(cmpConnect);
		cmpConnect.setLayout(new FormLayout());

		btnConnect = new Button(cmpConnect, SWT.CENTER);
		btnConnect.setImage( SWTResourceManager.getImage(MainWin.class, "/fkgui/gfx/lightning.png") ); //$NON-NLS-1$
		FormData fd_btnConnect = new FormData();
		fd_btnConnect.top = new FormAttachment(0, 8);
		fd_btnConnect.left = new FormAttachment(100, -125);
		fd_btnConnect.right = new FormAttachment(100, -10);

		btnConnect.setLayoutData(fd_btnConnect);

		btnConnect.addSelectionListener(new SelectionAdapter() {
			public void widgetSelected(SelectionEvent e) {

				if( fkSerial!=null && fkSerial.state == SerialState.Connected )
				{
					fkSerial.disconnect();
				} else {
					connect();
				}
			}

		});
		btnConnect.setText(Messages.MainWin_15);
		txtPsw = new Text(cmpConnect, SWT.BORDER | SWT.PASSWORD);
		FormData fd_txtPsw = new FormData();

		fd_txtPsw.left = new FormAttachment(0, 102);
		txtPsw.setLayoutData(fd_txtPsw);
		txtPsw.setFocus();
		txtPsw.addKeyListener( new KeyListener() {
			@Override
			public void keyReleased(KeyEvent arg0) { }

			@Override
			public void keyPressed(KeyEvent arg0) {
				if( arg0.character==SWT.CR )
				{
					connect();
				}
			}
		});

		txtLog = new Text(cmpConnect, SWT.BORDER | SWT.V_SCROLL | SWT.MULTI | SWT.WRAP);
		fd_btnConnect.bottom = new FormAttachment(txtPsw, 0, SWT.BOTTOM);
		FormData fd_txtLog = new FormData();
		fd_txtLog.bottom = new FormAttachment(100, -8);
		fd_txtLog.top = new FormAttachment(btnConnect, 8, SWT.BOTTOM);
		fd_txtLog.left = new FormAttachment(0, 8);
		fd_txtLog.right = new FormAttachment(btnConnect,0, SWT.RIGHT);
		txtLog.setLayoutData(fd_txtLog);
		txtLog.setEditable(false);

		lblPort = new Label(cmpConnect, SWT.NONE);
		lblPort.setAlignment(SWT.RIGHT);
		FormData fd_lblPort = new FormData();
		fd_lblPort.left = new FormAttachment(0, 10);
		lblPort.setLayoutData(fd_lblPort);
		lblPort.setText(Messages.MainWin_4);

		txtDev = new Text(cmpConnect, SWT.BORDER);
		fd_txtPsw.top = new FormAttachment(txtDev,4, SWT.BOTTOM);
		fd_lblPort.top = new FormAttachment(txtDev,0,SWT.CENTER);
		fd_lblPort.right = new FormAttachment(txtDev, -7);
		FormData fd_txtDev = new FormData();
		fd_txtDev.top = new FormAttachment(btnConnect,0,SWT.TOP);
		fd_txtDev.left = new FormAttachment(0, 102);
		txtDev.setLayoutData(fd_txtDev);
		txtDev.setText( prefs.get(PREF_PORT, PREF_DEFAULT_DEVICE));
		lblPassword = new Label(cmpConnect, SWT.NONE);
		lblPassword.setAlignment(SWT.RIGHT);
		FormData fd_lblPassword = new FormData();
		fd_lblPassword.right = new FormAttachment(0, 95);
		fd_lblPassword.top = new FormAttachment(txtPsw, 0, SWT.CENTER);
		fd_lblPassword.left = new FormAttachment(0, 10);
		lblPassword.setLayoutData(fd_lblPassword);
		lblPassword.setText(Messages.MainWin_18);

		animation = new Animation(cmpConnect, SWT.NONE, 4);
		fd_txtDev.right = new FormAttachment(animation,-16, SWT.LEFT );
		fd_txtPsw.right = new FormAttachment(animation,-16, SWT.LEFT );

		FormData fd_animation = new FormData();
		fd_animation.right = new FormAttachment(btnConnect, -16);
		fd_animation.top = new FormAttachment(0, 10);

		animation.setLayoutData(fd_animation);

		animation.setVisible(false);
		animation.setPlaying(false);
		cmpConnect.setTabList(new Control[]{txtPsw, btnConnect, txtDev});

		log(Messages.MainWin_22);


		//
		shell.addListener(SWT.Close, new Listener() {
			@Override
			public void handleEvent(Event arg0) {
				if( prefs.getBoolean(PREF_HIDE_ON_CLOSE, true))
				{
					arg0.doit=false;
					hideToTray();
				} else {
					shutDownApp();
				}
			}
		});


		if( System.getProperty("os.name").compareTo("Linux") == 0 ) //$NON-NLS-1$ //$NON-NLS-2$
		{
			Boolean gtkOk=false;
			Map<String, String> env = System.getenv();
			for (String envName : env.keySet()) {
				if( envName.compareTo("SWT_GTK3") == 0 && env.get(envName).compareTo("0") == 0 ) //$NON-NLS-1$ //$NON-NLS-2$
				{
					gtkOk=true;
				}
			}

			if( !gtkOk )
			{
				log("Warning: Enviroment variable SWT_GTK3 is not set to 0, if FinalKey GUI looks weird or crashes after connecting, try export GTK_SWT3=0 before running."); //$NON-NLS-1$
			}
		}

		Device display = Display.getCurrent();
		blackColor = display.getSystemColor(SWT.COLOR_BLACK );
		grayColor = display.getSystemColor(SWT.COLOR_GRAY );
		defaultBgColor = display.getSystemColor(SWT.COLOR_LIST_BACKGROUND );
		greenColor = display.getSystemColor(SWT.COLOR_DARK_GREEN );
		redColor = display.getSystemColor(SWT.COLOR_RED );

		
		//
		addSettingsTab();
		addThisFkTab();
		addAccountsTab();
		createSysTrayIcon();
	}