JOHANNES Casimirus, Comes palatinus