private JComponent drawDialogPane() {

        // Create the panel
        JPanel panel = new JPanel();
        panel.setLayout(new GridLayout());
        panel.setBorder(BorderFactory.createTitledBorder("Product"));
        
        //Getting items from warehouse tab 
        StockItem[] items = new StockItem[model.getWarehouseTableModel().getRowCount()];
		model.getWarehouseTableModel().getTableRows().toArray(items);

        // Initialize the textfields
        productSelectionJComboBoxField = new JComboBox<StockItem>(items);
        productSelectionJComboBoxField.setSize(this.getPreferredSize().width, this.getPreferredSize().height);
        barCodeField = new JTextField();
        quantityField = new JTextField("1");
        setNameField(new JTextField());
        priceField = new JTextField();

        // Fill the dialog fields if the bar code text field loses focus
        productSelectionJComboBoxField.addItemListener(new ItemListener() {
			public void itemStateChanged(ItemEvent e) {
				if(e.getStateChange() == ItemEvent.SELECTED){
					fillDialogFields((StockItem)e.getItem());
				}
			}
		});
 
        barCodeField.setEditable(false);
        getNameField().setEditable(false);
        priceField.setEditable(false);

        // == Add components to the panel
 		panel.add(productSelectionJComboBoxField, getItemConstraints(0,0,2));

 		// - bar code
 		panel.add(new JLabel("Bar code:"), getItemConstraints(0,1,1));
 		panel.add(barCodeField, getItemConstraints(1,1,1));

 		// - amount
 		panel.add(new JLabel("Amount:"), getItemConstraints(0,2,1));
 		panel.add(quantityField, getItemConstraints(1,2,1));

 		// - name
 		panel.add(new JLabel("Name:"), getItemConstraints(0,3,1));
 		panel.add(getNameField(), getItemConstraints(1,3,1));

 		// - price
 		panel.add(new JLabel("Price:"), getItemConstraints(0,4,1));
 		panel.add(priceField, getItemConstraints(1,4,1));

        // Create and add the button
        addItemButton = new JButton("Add to cart");
        addItemButton.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                addItemEventHandler();
            }
        });

        panel.add(addItemButton, getItemConstraints(0,5,2));

        return panel;
    }