How do I create a layer that is a rectangle with rounded corners?

Here's how I've done it:

  1. Create a new layer
  2. Make sure the layer has an alpha channel if it doesn't already (right-click, add alpha channel)
  3. Add a layer mask to the layer (right-click in the layer list, Add Layer Mask)
  4. In the layer mask options dialog, select 'White (full opacity)'
  5. You'll now have an additional little white square; this is the layer mask, and you can switch back and forth between the layer and the mask by clicking on each square. By default, you should now be working in the mask, which is what we want:

layer mask

Now, format the mask:

  1. Set the foreground paint color to black
  2. Choose the rectangle select tool, and set the rounded corner options that you want
  3. Drag to select the rounded-corner rectangle area that you want to be non-transparent
  4. Invert the selection (select | invert)
  5. Use the bucket tool to fill the areas outside the rectangle with black. Note that in fact, you're making those parts transparent, since you're painting on the mask rather than the layer, and black means transparent when you're working on the mask. So, whatever's behind should now start to show through. Before and after the bucket operation (my background layer is green):

enter image description hereenter image description here

Change back to working on the layer by clicking on the left square next to the layer name, in the layer list.

I'm running Gimp 2.8.0, if that makes any difference.