White dwarfs cool slowly for two reasons. They have an extremely small surface area to radiate this heat from, so they cool gradually, remaining hot for a long time. Also, they are very opaque. The degenerate matter that makes up the bulk of a white dwarf stops light and other electromagnetic radiation, so radiation does not carry away much energy.