public void remove(T key) {
   remove(items.remove(key));
   showEmptyMessage();
   setSize(getPreferredSize());
   validate(); // Update container
   containerWindow.pack();
 }
 public DynamicList(ItemEditor<T> editor, Window window) {
   this.editor = editor;
   containerWindow = window;
   GridLayout listLayout = new GridLayout(0, 1);
   setLayout(listLayout);
   items = new LinkedHashMap<T, JPanel>();
   emptyLabel = new JLabel("Survey is empty.");
   showEmptyMessage();
   setSize(getPreferredSize());
   setOpaque(true);
   setBackground(Color.WHITE);
 }