Could somebody explain and help me on these?

I am trying to paint on a window.

1. When I put a JPanel extended class in a JFrame, I don't have to override the painting but when I put the same class in another container like splitPane I have to override. Why?

2. When I change the size of a window the painting disappers in the above case but in a Frame it will changed with Frame size? How to get it the same situation with a Frame?