private void initialize() {

		setSize(400, 400);
		setLocation(xOffset * openFrameCount, yOffset * openFrameCount);
		setForeground(ColorFactory.getInstance().getForegroundColor());
		setBackground(ColorFactory.getInstance().getBackgroundColor());
		setOpaque(false);

		// create necessary stroke types for painting grid and blocks
		float[] dash = { 4, 2 };
		final BasicStroke gridStroke = new BasicStroke(1, BasicStroke.CAP_BUTT,
				BasicStroke.JOIN_MITER, 1, dash, 0);
		final BasicStroke defaultStroke = new BasicStroke(1);

		setContentPane(new JPanel() {

			private static final long serialVersionUID = -2286655611111287860L;

			@Override
			protected void paintComponent(final Graphics g) {

				Graphics2D g2d = (Graphics2D) g;
				g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
						RenderingHints.VALUE_ANTIALIAS_ON);
				g2d.setRenderingHint(RenderingHints.KEY_RENDERING,
						RenderingHints.VALUE_RENDER_SPEED);

				drawBackground(g2d);

				// draw all blocks
				for (BaseView b : blocksInCircuit) {
					b.drawBlock(g);
				}

				// draw selection rectangle
				if (selecting) {
					g2d.setColor(ColorFactory.getInstance().getShadowColor());
					g2d.drawRect(mouseRect.x, mouseRect.y, mouseRect.width,
							mouseRect.height);
				}

				// draw currently made connection
				if (connecting) {
					g2d.setColor(ColorFactory.getInstance().getHighlightColor());
					int x1 = signalConnectionBegin.pointForSignal().x;
					int y1 = signalConnectionBegin.pointForSignal().y;
					int x2 = mousePt.x;
					int y2 = mousePt.y;
					g2d.drawLine(x1, y1, x2, y2);
				}

				// draw all connections that already exist
				for (Connection c : connections) {
					g2d.setColor(ColorFactory.getInstance().getLineColor());
					c.drawConnection(g2d);
				}
			}

			/**
			 * Draws background grid on panel.
			 * 
			 * @param g2d
			 *            graphics context to paint into
			 */
			private void drawBackground(final Graphics2D g2d) {

				g2d.setColor(ColorFactory.getInstance().getBackgroundColor());
				g2d.fillRect(0, 0, getWidth(), getHeight());
				g2d.setColor(ColorFactory.getInstance().getGridColor());
				g2d.setStroke(gridStroke);
				for (int i = 0; i < CIRCUIT_PANEL_WIDTH; i += 50) {
					g2d.drawLine(i, 0, i, CIRCUIT_PANEL_HEIGTH);
				}
				for (int i = 0; i < CIRCUIT_PANEL_HEIGTH; i += 50) {
					g2d.drawLine(0, i, CIRCUIT_PANEL_WIDTH, i);
				}
				g2d.setColor(ColorFactory.getInstance().getForegroundColor());
				g2d.setStroke(defaultStroke);
			}
		});
	}