Miter the ends of two planks of 60-inch 2-by-2-inch lumber and two planks of 40-inch 2-by-2-inch lumber to 45 degrees with a miter saw. This will make a headboard for a queen-size bed. Change the dimensions to suit your needs.
Assemble the planks into a rectangular frame. Place glue on the mitered ends, which will form the corners of the headboard, and leave them to dry for an hour, clamped in corner clamps.
Drill two pilot holes, sized to fit 2-inch screws, through each corner joint, then secure the frame together by driving the screws into the pilot holes.
Roll out the foam batting and place the headboard frame over it. Cut the batting 5 inches out from the edge of the frame.
Pull the batting up and over the back of the headboard frame and secure it in place with a staple in the center. On the opposite side of the frame, pull up the batting and attach it with a staple in the center. Then repeat on the other two sides of the frame. This ensures an even pull on the batting. At this point the batting is secured with only four staples.
Continue attaching the batting to the frame, rotating a quarter of the way around the frame after each staple to achieve a firm but evenly stretched batting.
Lay out the headboard fabric with the wrong side up, and place the headboard frame down with the batting side touching the fabric. Repeat the procedures of Steps 5 and 6, for attaching the batting, to attach the fabric to the headboard frame.
Scribe a level line on the wall above the bed at the height you want the headboard to hang. Use a stud finder to locate the position of the wall studs on the line.
Place a 55-inch length of 1-by-2-inch lumber on the level line. This is the wall cleat. Fix the cleat in place with two 3-inch screws drilled into each of the stud positions along the line.
Hang the headboard frame on top of the cleat and push it back so that it sits flush with the wall. Drive 3-inch screws through the top of the headboard frame into the wall-attached cleat, one every 5 to 6 inches, staggering the screw position with the screws that attach the cleat to the wall.