This demonstration shows the relationship between the Type I error (α), Type II error (β), difference in means (), sample size (n), standard deviation () and the power of a 2-sided hypothesis test.

The hypothesised distribution. The top curve shows the hypothesised distribution of the sample mean under the null hypothesis
.
The region corresponding to a Type I error is shaded red.
You can change α, n and σ using the controls at the top-right corner.

The alternate distribution. When ready, click 'Show alternate distribution' to display an alternate distribution of the sample mean .
Click the 'Show power' checkbox to reveal the area (shaded green) corresponding to the power of the test.
Click the 'Show Type II error region' checkbox to reveal the area (shaded blue) corresponding to the probability of making a Type II error.
Drag the green point to change the alternate mean μ. Or press the 'play' button in the bottom-left corner to make it animate.

Use the 'Vertical separation' slider to superimpose or separate the two graphs. (This is purely visual, it has no effect on the hypothesis test.)
There is a version of this applet with larger sample sizes available at http://geogebratube.org/student/maRmuYxRY