question: private JPanel buildPanelForOperation ( final BatchOperation operation , final ArrayList < Pokemon > pokes ) { final JPanel panel = new JPanel ( ) ; panel . setLayout ( new BoxLayout ( panel , BoxLayout . X_AXIS ) ) ; final JPanel innerPanel = new JPanel ( ) ; innerPanel . setLayout ( new BoxLayout ( innerPanel , BoxLayout . Y_AXIS ) ) ; innerPanel . setAlignmentX ( CENTER_ALIGNMENT ) ; final JScrollPane scroll = new JScrollPane ( innerPanel ) ; scroll . setAlignmentX ( CENTER_ALIGNMENT ) ; final int height = Math . min ( 400 , pokes . size ( ) * 20 + 5 ) ; panel . setPreferredSize ( new Dimension ( 500 , height ) ) ; pokes . forEach ( null ) ; panel . add ( scroll ) ; return panel ; }
target:  Internal function to build the panel for a batch operation.