Paint implementation in in Java