isMinimumSizeDirty = true;
int start = e.getIndex0(); int end = e.getIndex1(); if (start == 0 && comboBox.getItemCount() - (end - start + 1) == 0) { contentsChanged(e); } else if (start != -1  || end != -1) { ListCellRenderer renderer = comboBox.getRenderer(); ComboBoxModel model = comboBox.getModel(); int w = displaySize.width; int h = displaySize.height;  for (int i = start; i <= end; ++i) { Component comp = renderer.getListCellRendererComponent(listBox, model.getElementAt(i), -1, false, false); currentValuePane.add(comp); comp.setFont(comboBox.getFont()); Dimension dim = comp.getPreferredSize(); w = Math.max(w, dim.width); h = Math.max(h, dim.height); currentValuePane.remove(comp); } if (displaySize.width < w || displaySize.height < h) { if (displaySize.width < w) { displaySize.width = w; } if (displaySize.height < h) { displaySize.height = h; } comboBox.revalidate(); if (editor != null) { comboBox.configureEditor(comboBox.getEditor(), comboBox.getSelectedItem()); } } }
    public void intervalAdded(ListDataEvent e)    {      // Lets assume every change invalidates the minimumsize.      isMinimumSizeDirty = true;      ComboBoxModel model = comboBox.getModel();      ListCellRenderer renderer = comboBox.getRenderer();      if (displaySize == null)        displaySize = getDisplaySize();      if (displaySize.width < getDefaultSize().width)        displaySize.width = getDefaultSize().width;      if (displaySize.height < getDefaultSize().height)        displaySize.height = getDefaultSize().height;      comboBox.repaint();    }