I'm confused by this addElement convert to add. The addElement, means that we control where the element goes to (methods or attributes), however, this add, is derived from JPanel -> Container which we don't directly control. Are you sure this is what you want to do?