private JComboBox < String > getSiteSelect ( ) { if ( siteSelect == null ) { siteSelect = new JComboBox <> ( siteModel ) ; siteSelect . addItem ( Constant . messages . getString ( "httpsessions.toolbar.site.select" ) ) ; siteSelect . setSelectedIndex ( 0 ) ; // Add the item listener for when the site is selected siteSelect . addItemListener ( new ItemListener ( ) { @ Override public void itemStateChanged ( ItemEvent e ) { if ( ItemEvent . SELECTED == e . getStateChange ( ) ) { if ( siteSelect . getSelectedIndex ( ) > 0 ) { siteSelected ( ( String ) e . getItem ( ) ) ; } // If the user selects the first option (empty one), force the selection to // the first valid site else if ( siteModel . getSize ( ) > 1 ) { siteModel . setSelectedItem ( siteModel . getElementAt ( 1 ) ) ; } } } } ) ; } return siteSelect ; }
Gets the site select ComboBox .