I found one example in which buttons are added to panels (instances of JPanel) then panels are added to the the containers (instances generated by getCont
I believe the reason is because Swing was built off of AWT, and Container is a top level AWT object. It really isn't the greatest design choice, though, since you generally don't want to mix AWT (heavyweight) objects with Swing (lightweight).
I think the best way to handle it is to always cast the contentPane to a JPanel.
JPanel contentPanel = (JPanel)aFrame.getContentPane();