To relate two different JComboBoxes in your program, you can use event listeners to detect changes in the selection of the first JComboBox (e.g., fruits and vegetables). Based on the selected item, you can populate the second JComboBox with the corresponding options (e.g., if fruits are selected, populate the second JComboBox with fruit options). You can achieve this by implementing the ActionListener interface and adding an ActionListener to the first JComboBox. Within the actionPerformed method, you can update the options in the second JComboBox accordingly.