java jcombobox without scrollbar?

I have a JComboBox component:

ho2Combo = new JComboBox();
ho2Combo.setLocation(x, y);
ho2Combo.setSize(w, h);
ho2Combo.setFont(comboFont);
ho2Combo.setModel(new DefaultComboBoxModel(Format.model(0))); //this fills up the combobox
ho2Combo.setSelectedIndex(0);
ho2Combo.addItemListener(new ItemListener() {
    public void itemStateChanged(ItemEvent evt) {
        ho2ComboItemStateChanged(evt);
     }
});
add(ho2Combo);

And I would love to have this combobox without scrollbar! How could I reach this? Please help! Thanks!

Answers


If you're confident that all elements will fit on screen, then you can use:

ho2Combo.setMaximumRowCount(ho2Combo.getModel().getSize());

Need Your Help

Why am I getting this error: "Cannot add foreign key constraint."

mysql foreign-keys ddl

When executing the following SQL statements it gives me an error such as "Error 1215: Cannot add foreign key constraint" at the first table: process.