I remember reading a book in my much younger days called "Revolt in Paradise" about this period and this area - written by the woman known as Surabaya Sue. A fascinating woman. She called herself by her Indonesian name, K'tut Tantri, but was born with the much more prosaic name of Muriel Pearson. She had Scottish-American-Australian connections. My mother bought the book because she remembered hearing her on the radio while she was in Australia in the 1940s drumming up support for Indonesian independence. You can read a little about her here. (Surabaya is not far from Yogya.)
The palace was built in the 18th century and was once much, much larger. It has been modernised from time to time, but the basic buildings remain the same.