Train (kereta api) in Indonesia is quite well connected within Java and using it would be easy with these information.
Train Rail MapClick on the maps for bigger view
Check here at their Indonesia official train website (http://www.kereta-api.co.id/) for the timetable for each destinations, like between Jakarta to Yogyakarta, or Jakarta to Surabaya or Yogayakarta to Malang. Unfortunately the site is only in Bahasa Indonesia (Indonesian) but you can read the names of the places, note that Tanggal is date, Stasiun Asal is From and Stasiun Tujuan is To.
Train Fare Price
Also at the official train website, after selecting your to and fro destinations, you will find the price listed for different type of trains and also different companies of train.