Java JComboBox Item makeComboBox(Object[] items)

Here you can find the source of makeComboBox(Object[] items)

Description

Creates a combo box that remains one line in height.

License

Open Source License

Declaration

public static JComboBox makeComboBox(Object[] items) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.awt.*;
import javax.swing.*;

public class Main {
    /** Creates a combo box that remains one line in height. */
    public static JComboBox makeComboBox(Object[] items) {
        return new JComboBox(items) {
            public Dimension getMaximumSize() {
                Dimension pref = getPreferredSize();
                Dimension max = super.getMaximumSize();
                return new Dimension(max.width, pref.height);
            }//from   ww w  .ja va  2  s . com
        };
    }
}

Related

  1. insertIntoCombo(JComboBox combo, Object item)
  2. items(JComboBox comboBox)
  3. loadCombo(JComboBox cmb, List data)
  4. loadInstances(JComboBox target, Class source, Class limit, Object defaultItem)
  5. loadStaticItems(JComboBox target, Class source, Class limit, String defaultItem)
  6. replaceComboContents(JComboBox cb, String[] items)
  7. replaceComboItems(JComboBox combo, Vector items)
  8. selJComboBoxItem(Properties properties, JComboBox combo, Vector namVec, String name)
  9. selJComboBoxItem(Properties properties, JComboBox combo, Vector namVec, String name)