question: private JPanel createLegendPanel ( JPanel basePanel ) { final JPanel panel ; if ( basePanel != null ) { basePanel . removeAll ( ) ; basePanel . setLayout ( new GridBagLayout ( ) ) ; panel = basePanel ; } else { panel = new JPanel ( new GridBagLayout ( ) ) ; } panel . setBorder ( BorderFactory . createTitledBorder ( I18n . tr ( "Legend" ) ) ) ; GridBagConstraints gbc = new GridBagConstraints ( ) ; gbc . anchor = GridBagConstraints . WEST ; gbc . insets = new Insets ( 0 , 4 , 0 , 6 ) ; JCheckBox checkBox = new JCheckBox ( ) ; checkBox . setSelected ( true ) ; panel . add ( createIconLabel ( checkBox ) , gbc ) ; MultiLineLabel label = new MultiLineLabel ( I18n . tr ( "Folder and subfolders are included in the Library." ) , true ) ; GridBagConstraints labelGbc = new GridBagConstraints ( ) ; labelGbc . anchor = GridBagConstraints . WEST ; labelGbc . fill = GridBagConstraints . HORIZONTAL ; labelGbc . gridwidth = GridBagConstraints . REMAINDER ; labelGbc . gridx = 1 ; labelGbc . weightx = 1 ; panel . add ( label , labelGbc ) ; checkBox . setSelected ( false ) ; gbc . gridy = 1 ; panel . add ( createIconLabel ( checkBox ) , gbc ) ; label = new MultiLineLabel ( I18n . tr ( "Folder is not included and no subfolders are included in the Library." ) , true ) ; labelGbc . gridy = 1 ; panel . add ( label , labelGbc ) ; checkBox . setIcon ( partiallyIncludedIcon ) ; gbc . gridy = 2 ; gbc . insets = new Insets ( 0 , 6 , 0 , 0 ) ; panel . add ( createIconLabel ( checkBox ) , gbc ) ; label = new MultiLineLabel ( I18n . tr ( "Folder\'s files and some subfolders are included in the Library." ) , true ) ; labelGbc . gridy = 2 ; gbc . insets = null ; panel . add ( label , labelGbc ) ; return panel ; }
target:  Create the legend   If basePanel is non-null, the legend panel replaces the contents of that panel.