Example usage for javax.swing JComboBox putClientProperty

List of usage examples for javax.swing JComboBox putClientProperty

Introduction

In this page you can find the example usage for javax.swing JComboBox putClientProperty.

Prototype

public final void putClientProperty(Object key, Object value) 

Source Link

Document

Adds an arbitrary key/value "client property" to this component.

Usage

From source file:Main.java

public Main() {
    Vector model = new Vector();
    model.addElement(new Item(1, "A"));
    model.addElement(new Item(2, "B"));
    model.addElement(new Item(3, "C"));
    model.addElement(new Item(4, "D"));

    JComboBox comboBox = new JComboBox(model);
    comboBox.addActionListener(this);
    comboBox.putClientProperty("JComboBox.isTableCellEditor", Boolean.TRUE);
    getContentPane().add(comboBox, BorderLayout.NORTH);

    comboBox = new JComboBox(model);
    comboBox.setRenderer(new ItemRenderer());
    comboBox.addActionListener(this);
    getContentPane().add(comboBox, BorderLayout.SOUTH);
}

From source file:com.aw.swing.mvp.binding.component.BndSJTable.java

private JComboBox getJComboBox(ComboBoxModel comboBoxModel) {
    final JComboBox jComboBox = new JComboBox(comboBoxModel);
    jComboBox.addFocusListener(new CellEditableFocusListener());
    jComboBox.setRequestFocusEnabled(true);
    jComboBox.putClientProperty(CellEditorUtils.AW_CELL_EDITOR, Boolean.TRUE);
    jComboBox.putClientProperty("JComboBox.isTableCellEditor", Boolean.TRUE);
    jComboBox.addAncestorListener(new AncestorListener() {
        public void ancestorAdded(AncestorEvent event) {
            jComboBox.requestFocusInWindow();
        }//from   ww  w .  j a  va 2s. c o  m

        public void ancestorMoved(AncestorEvent event) {
        }

        public void ancestorRemoved(AncestorEvent event) {
        }
    });
    return jComboBox;
}

From source file:edu.ku.brc.ui.UIHelper.java

public static JComboBox createComboBox() {
    JComboBox cbx = new JComboBox();
    setControlSize(cbx);/* w  ww . j  a  v  a 2 s . c  o m*/
    if (isMacOS_10_5_X) {
        cbx.putClientProperty("JComboBox.isPopDown", Boolean.TRUE);
    }
    return cbx;
}

From source file:edu.ku.brc.ui.UIHelper.java

public static JComboBox createComboBox(final Vector<?> items) {
    @SuppressWarnings("unchecked")
    JComboBox cbx = new JComboBox(items);
    setControlSize(cbx);/*w w  w  .j a va  2  s  .  c  o m*/
    if (isMacOS_10_5_X) {
        cbx.putClientProperty("JComboBox.isPopDown", Boolean.TRUE);
    }
    return cbx;
}

From source file:edu.ku.brc.ui.UIHelper.java

public static JComboBox createComboBox(final ComboBoxModel model) {
    @SuppressWarnings("unchecked")
    JComboBox cbx = new JComboBox(model);
    setControlSize(cbx);//from   www.  j av  a2 s. co  m
    if (isMacOS_10_5_X) {
        cbx.putClientProperty("JComboBox.isPopDown", Boolean.TRUE);
    }
    return cbx;
}

From source file:edu.ku.brc.ui.UIHelper.java

@SuppressWarnings("rawtypes")
public static JComboBox createComboBox(final Object[] items) {
    @SuppressWarnings("unchecked")
    JComboBox cbx = new JComboBox(items);
    setControlSize(cbx);//from  w  ww.  j  a va 2  s  .  c om
    if (isMacOS_10_5_X) {
        cbx.putClientProperty("JComboBox.isPopDown", Boolean.TRUE);
    }
    return cbx;
}