Defining the size of a JComboBox

If you want to change the size of the JComboBox component itself, use:

   combobox.setPreferredSize(new Dimension(x, y));

If you want to have control over the popupwidth and popupheight, extend JComboBox and add the necessary functionality to a custom ComboBoxUI:
Main.java:

import javax.swing.plaf.metal.*;
import javax.swing.plaf.basic.*;
import java.awt.event.*;
import javax.swing.*;
import java.util.*;
import java.awt.*;
    
public class Main extends JFrame
{ 
   public Main() {
      getContentPane().setLayout(new FlowLayout());
      
      Vector v = new Vector();
      for (int i=0; i<20; i++)
         v.addElement("ComboBox Item #" + i);
      SizedJComboBox combobox = new SizedJComboBox(v);
 
      combobox.setPopupWidth(190);
      combobox.setPopupHeight(30);
 
      getContentPane().add(combobox);
  
      addWindowListener(new WindowAdapter() {
         public void windowClosing(WindowEvent we) {
            System.exit(1);
         }
      });      
   
      setSize(new Dimension(200, 200));
   } 
 
   public static void main(String[] args) throws Exception {
      Main main = new Main();
      main.setVisible(true);
   }
}
 
class SizedJComboBox extends JComboBox {
   protected int popupWidth;
   protected int popupHeight;
 
   public SizedJComboBox(ComboBoxModel aModel) {
      super(aModel);
      setUI(new SizedComboBoxUI());
   }
 
   public SizedJComboBox(final Object[] items) { 
      super(items); 
      setUI(new SizedComboBoxUI());
   } 
 
   public SizedJComboBox(Vector items) { 
      super(items); 
      setUI(new SizedComboBoxUI()); 
   } 
 
   public void setPopupWidth(int width) { 
      popupWidth = width; 
   }
 
   public void setPopupHeight(int height) {
      popupHeight = height;
   } 
 
   public Dimension getPopupSize() { 
      Dimension size = getSize(); 
      if (popupWidth < 1) popupWidth = size.width; 
      return new Dimension(popupWidth, popupHeight); 
   } 
}
 
class SizedComboBoxUI extends MetalComboBoxUI {
   protected ComboPopup createPopup() { 
      BasicComboPopup popup = new BasicComboPopup(comboBox) { 
         public void show() { 
            Dimension popupSize = ((SizedJComboBox) comboBox).getPopupSize(); 
            popupSize.setSize(popupSize.width, popupSize.height < 1 ? getPopupHeightForRowCount(comboBox.getMaximumRowCount()) : popupSize.height); 
            Rectangle popupBounds = computePopupBounds( 0, 
                  comboBox.getBounds().height, popupSize.width, popupSize.height); 
            scroller.setMaximumSize(popupBounds.getSize()); 
            scroller.setPreferredSize(popupBounds.getSize()); 
            scroller.setMinimumSize(popupBounds.getSize()); 
            list.invalidate(); 
            int selectedIndex = comboBox.getSelectedIndex(); 
            if (selectedIndex == -1) { 
               list.clearSelection(); 
            } else { 
               list.setSelectedIndex( selectedIndex ); 
            } 
            list.ensureIndexIsVisible( list.getSelectedIndex() ); 
            setLightWeightPopupEnabled(comboBox.isLightWeightPopupEnabled()); 
 
            show(comboBox, popupBounds.x, popupBounds.y); 
         } 
      }; 
 
      popup.getAccessibleContext().setAccessibleParent(comboBox); 
      return popup; 
   } 
}