Extract panel display code into helper function.