title: Java reAdd items that have been removed from JComboBox
body: <p>What i'm trying to do is whenever i press the "Remove" Button it will remove the item that i have selected in the JComboBox. So once i have removed all the items, I have another button called "Reset" where all the items that have been removed will be inside the JComboBox again and is it possible to have a restore method instead of having to reAdd each model again cause my actual program has lots of models</p>
  
  <p>This is what i have tried but it doesnt work any suggestions how can this be done?</p>
  
  <pre><code>public class Testing{
  
      JFrame frame;
      JPanel panel;
      JButton remove,reset;
      JComboBox box;
      final DefaultComboBoxModel items = new DefaultComboBoxModel(new String[]
      {
          "-","Database System","Computer Fundamentals",
          "Computer Maths","Internet Web Tech","Tertiary English 1"                              
      });
  
      public void display()
      {
          frame = new JFrame();
          panel = new JPanel();
  
          box = new JComboBox();
          box.setModel(items);
          remove = new JButton("Remove");
          reset = new JButton("Reset");
  
          remove.addActionListener((ActionEvent e)-&gt;{   
          box.removeItem(box.getSelectedItem());
          });
  
          reset.addActionListener((ActionEvent e)-&gt;{    
          System.out.println("Reset");
          box.setModel(items);
          box.revalidate();
          box.repaint();
  
          });
  
          panel.revalidate();
          panel.repaint();
          panel.add(box);
          panel.add(remove);
          panel.add(reset);
          frame.add(panel);
          frame.setVisible(true);
          frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
          frame.setSize(300,300);
      }
  
      public static void main(String[] args) 
      {
          TestingProgram te = new TestingProgram();
          te.display();
      }
  }
  </code></pre>