You can use NickGammon's method to program them,
or get a dedicated programmer, Atmel AVR ISP MKii, $34 at mouser.com
and within the IDE use
Tools: Burn Bootloader to get the fuses set correctly,
and then
File: Upload Using Programmer within the IDE to program them.
Adding these core files tothe IDE will let you load up 1284P chips as well: