The great monuments of Java are either Hindu or Buddhist, or more likely combinations of both. Most of the sites were built in Java's heroic age of temple constuction, which lasted from the 8th to the 10th centuries. For mysterious reasons, many of these sites were abandoned soon after they were built.
Even if most Javanese are Islamic, they are generally not followers of the branches of Islam associated with the Near East. The Javanese have fused Islam with the island's traditional mysticism, much like the Sufis of northern India. It is far from the fundamentalist vision. For instance, it is illegal to agitate for the establishment of an Islamic state, and believers are required to sign a document declaring that they won't.
Because of this native tolerance — at least for different spiritualities — many of the monuments of other religions were simply abandoned, rather than being defaced or destroyed. The greatest damage to the monuments have come in the last century, as expanding populations have moved into formerly deserted areas and pillaged ruins for building materials, or by art collectors, who have carted away sculptures for museums and private collections.
But the destruction has abated. The Indonesian government, working with archeologists, has moved to protect and preserve these monuments.