client/ClientWindow.java
/**
		 * Add a new dish to the menu display
		 * @param dish The dish to display
		 */
Add a new dish to the menu display
@param dish The dish to display
Add a new dish to the menu display @param dish The dish to display
private void addDish(Dish dish) {
			d.gridy++;
			JPanel dishPanel = new JPanel();
			dishPanel.setLayout(new BorderLayout());
			dishPanel.setBorder(BorderFactory.createLineBorder(Color.black));
			JLabel dishLabel = new JLabel("<html><strong>" + dish.getName() + " (" + moneyFormat.format(client.getDishPrice(dish)) + ")</strong><p>" + client.getDishDescription(dish) + "</p></html>");
			dishLabel.setHorizontalAlignment(SwingConstants.LEFT);
			SpinnerNumberModel minMax = new SpinnerNumberModel(0,0,100000,1);
			JSpinner quantity = new JSpinner();
			quantity.setModel(minMax);
			JButton addToBasket = new JButton("Add to Basket");
			dishPanel.add(dishLabel,BorderLayout.NORTH);
			JPanel buttonPanel = new JPanel(new BorderLayout());
			buttonPanel.add(quantity,BorderLayout.WEST);
			buttonPanel.add(addToBasket,BorderLayout.EAST);
			dishPanel.add(buttonPanel);
			addToBasket.addActionListener(e -> {
				client.addDishToBasket(user, dish, (Number) quantity.getValue());
				menuPanel.refreshBasket();
				quantity.setValue(0);
			});
			menu.add(dishPanel,d);
			menuItems.put(dish, dishPanel);
		}
private void addDish ( Dish dish ) { d . gridy ++ ; JPanel dishPanel = new JPanel ( ) ; dishPanel . setLayout ( new BorderLayout ( ) ) ; dishPanel . setBorder ( BorderFactory . createLineBorder ( Color . black ) ) ; JLabel dishLabel = new JLabel ( "<html><strong>" + dish . getName ( ) + " (" + moneyFormat . format ( client . getDishPrice ( dish ) ) + ")</strong><p>" + client . getDishDescription ( dish ) + "</p></html>" ) ; dishLabel . setHorizontalAlignment ( SwingConstants . LEFT ) ; SpinnerNumberModel minMax = new SpinnerNumberModel ( 0 , 0 , 100000 , 1 ) ; JSpinner quantity = new JSpinner ( ) ; quantity . setModel ( minMax ) ; JButton addToBasket = new JButton ( "Add to Basket" ) ; dishPanel . add ( dishLabel , BorderLayout . NORTH ) ; JPanel buttonPanel = new JPanel ( new BorderLayout ( ) ) ; buttonPanel . add ( quantity , BorderLayout . WEST ) ; buttonPanel . add ( addToBasket , BorderLayout . EAST ) ; dishPanel . add ( buttonPanel ) ; addToBasket . addActionListener ( e -> { client . addDishToBasket ( user , dish , ( Number ) quantity . getValue ( ) ) ; menuPanel . refreshBasket ( ) ; quantity . setValue ( 0 ) ; } ) ; menu . add ( dishPanel , d ) ; menuItems . put ( dish , dishPanel ) ; }
Add a new dish to the menu display
 @param dish The dish to display
Add a new dish to the menu display @param dish The dish to display