private void paint(Display display, GC gc) {
		Color white = colors.getWhite();
		Color black = colors.getBlack();
		Color grey30 = colors.getGrey30();
		Color grey50 = colors.getGrey50();
		Color grey80 = colors.getGrey80();
		Color grey120 = colors.getGrey120();

		// Calculate left margin to center the keyboard.
		int clientWidth = nWhiteKeys * keyWidth + 10;
		int leftMargin = (getWidget().getBounds().width - clientWidth - 20) / 2 + 5;
		
		Pitch pitch;
		
		pitch = new Pitch("a0");

		// Draw the border of the keyboard.
		gc.setBackground(grey30);
		gc.fillRectangle(leftMargin - borderWidth, topMargin - borderWidth - 1, nWhiteKeys * keyWidth + borderWidth * 2 + 1, keyHeight + borderWidth + 2);
		
		// Draw a gradient above the keyboard.
		gc.setBackground(grey30);
		gc.setForeground(grey120);
		gc.fillGradientRectangle(leftMargin - borderWidth + 1, topMargin - borderWidth, nWhiteKeys * keyWidth + borderWidth * 2 - 1, topMargin, true);
		
		// Draw every white key.
		for(int x = 0; x < nWhiteKeys; x++) {
			Color selected = getSelectedColor(pitch);

			// Draw rectangle for the key.
			gc.setForeground(black);
			gc.setBackground((selected != null) ? selected : white);
			gc.fillRectangle(leftMargin + keyWidth * x, topMargin, keyWidth, keyHeight);
			gc.drawRectangle(leftMargin + keyWidth * x, topMargin, keyWidth, keyHeight);
			
			// Get the pitch of the next white key.
			pitch = pitch.nextSemitone();
			// Add an extra semitone except between B/C and E/F.
			if(x % 7 != 1 && x % 7 != 4) {
				pitch = pitch.nextSemitone();
			}
		}
		
		pitch = new Pitch("a#0");
		
		// Draw every black key.
		for(int x = 0; x < nWhiteKeys - 1; x++) {
			// Skip a black key between B/C and E/F.
			if(x % 7 == 1 || x % 7 == 4) {
				pitch = pitch.nextSemitone();
				continue;
			}
			
			Color selected = getSelectedColor(pitch);
			
			int left = leftMargin + keyWidth * x + keyWidth / 2 + blackMargin;
			int width = keyWidth - blackMargin * 2 + 1;
			
			// Draw rectangle for this key.
			gc.setForeground(black);
			gc.setBackground((selected != null) ? selected : black);
			gc.fillRectangle(left, topMargin, width, blackKeyHeight);
			gc.drawRectangle(left, topMargin, width, blackKeyHeight);
			
			if(selected == null) {
				// Add a lower highlight to the key.
				gc.setBackground(grey50);
				gc.fillRectangle(left + 1, topMargin + blackKeyHeight - 5, width - 1, 5);
				gc.setForeground(grey80);
				gc.drawLine(left + 1, topMargin + blackKeyHeight - 5, left + width - 1, topMargin + blackKeyHeight - 5);
			}
			
			// Get the pitch of the next black key.
			pitch = pitch.nextSemitone();
			pitch = pitch.nextSemitone();
		}
	}