topHalf.add( listContainer );
//Create JList for items, add to scroll pane and then add to parent
// container
JList list = new JList( items );
ListSelectionModel listSelectionModel = list.getSelectionModel( );
listSelectionModel
.setSelectionMode( ListSelectionModel.SINGLE_SELECTION );
//handler adds item to shopping cart
list.addMouseListener( new ListSelectionHandler( ) );
JScrollPane listPane = new JScrollPane( list );
listContainer.add( listPane );
JPanel tableContainer = new JPanel( new GridLayout( 1, 1 ) );
tableContainer.setBorder( BorderFactory.createTitledBorder( "Table" ) );
topHalf.add( tableContainer );
//Container that displays table showing items in cart
tableModel = new TableModel( );
JTable table = new JTable( tableModel );
//handler removes item to shopping cart
table.addMouseListener( new TableSelectionHandler( ) );
ListSelectionModel tableSelectionModel = table.getSelectionModel( );
tableSelectionModel
.setSelectionMode( ListSelectionModel.SINGLE_SELECTION );
TableColumnModel tableColumnModel = table.getColumnModel( );
//notice we have a custom renderer for each column as both columns
// point to the same underlying object
tableColumnModel.getColumn( 0 ).setCellRenderer( new NameRenderer( ) );