private void setPanels( final Map<Long, NotePanel> newPanels ) {
		final Iterator<NotePanel> newPanelsIterator = newPanels.values().iterator();
		int panelComponentIndex = getComponentCount() - 1;

		while( panelComponentIndex >= 0 && newPanelsIterator.hasNext() ) {
			final NotePanel newPanel = newPanelsIterator.next();
			final NotePanel oldPanel = (NotePanel) getComponent( panelComponentIndex );

			if( newPanel != oldPanel ) {
				add( newPanel, panelComponentIndex );
			}

			panelComponentIndex -= 1;
		}

		while( panelComponentIndex >= 0 ) {
			remove( panelComponentIndex );
			panelComponentIndex -= 1;
		}

		while( newPanelsIterator.hasNext() ) {
			add( newPanelsIterator.next(), 0 );
		}

		notePanels = newPanels;

		mainWindow.validate();
		mainWindow.repaint();
	}