code: @Override
      protected void prepareGUI(Container container)
      {
          itineraryPanel = new ItineraryPanel(distances.getKnownCities());
          strategyPanel = new StrategyPanel(distances);
          executionPanel = new ExecutionPanel();
  
          container.add(itineraryPanel, BorderLayout.WEST);
          JPanel innerPanel = new JPanel(new BorderLayout());
          innerPanel.add(strategyPanel, BorderLayout.NORTH);
          innerPanel.add(executionPanel, BorderLayout.CENTER);
          container.add(innerPanel, BorderLayout.CENTER);
  
          executionPanel.addActionListener(new ActionListener()
          {
              public void actionPerformed(ActionEvent actionEvent)
              {
                  Collection<String> cities = itineraryPanel.getSelectedCities();
                  if (cities.size() < 4)
                  {
                      JOptionPane.showMessageDialog(TravellingSalesmanApplet.this,
                                                    "Itinerary must include at least 4 cities.",
                                                    "Error",
                                                    JOptionPane.ERROR_MESSAGE);
                  }
                  else
                  {
                      try
                      {
                          setEnabled(false);
                          createTask(cities).execute();
                      }
                      catch (IllegalArgumentException ex)
                      {
                          JOptionPane.showMessageDialog(TravellingSalesmanApplet.this,
                                                        ex.getMessage(),
                                                        "Error",
                                                        JOptionPane.ERROR_MESSAGE);
                          setEnabled(true);
                      }
                  }
              }
          });
          container.validate();
      }
docs: Initialise and layout the GUI.
  @param container The Swing component that will contain the GUI controls.