Example usage for javax.swing JComboBox addItemListener

List of usage examples for javax.swing JComboBox addItemListener

Introduction

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

Prototype

public void addItemListener(ItemListener aListener) 

Source Link

Document

Adds an ItemListener.

Usage

From source file:ComboBoxWithItemChangedListener.java

public ComboPanel() {
    final JComboBox combo = new JComboBox(treasure);
    combo.setMaximumRowCount(5);/*from  w  w w .  j  ava2  s .  co m*/
    combo.addItemListener(new ItemListener() {
        public void itemStateChanged(ItemEvent e) {
            System.out.println("Combo: " + combo.getSelectedItem());
        }
    });
    combo.setSelectedIndex(4);
    add(combo);
}

From source file:Main.java

public Main() {
    JComboBox jc = new JComboBox();
    jc.addItem("France");
    jc.addItem("Germany");
    jc.addItem("Italy");
    jc.addItem("Japan");
    jc.addItemListener(this);
    add(jc);/*from  ww  w .  j  ava2  s  . c o m*/
    System.out.println(jc.getMaximumRowCount());
}

From source file:Main.java

public Main() {
    JComboBox jc = new JComboBox();
    jc.addItem("France");
    jc.addItem("Germany");
    jc.addItem("Italy");
    jc.addItem("Japan");
    jc.addItemListener(this);
    add(jc);/*from  ww w.  ja v a 2 s. c  o m*/
    ComboBoxModel model = jc.getModel();
}

From source file:Main.java

public Main() {
    JComboBox jc = new JComboBox();
    jc.addItem("France");
    jc.addItem("Germany");
    jc.addItem("Italy");
    jc.addItem("Japan");
    jc.addItemListener(this);
    add(jc);//from www .  j av a 2  s. co m
    ActionListener[] lis = jc.getActionListeners();
}

From source file:Main.java

public Main() {
    JComboBox jc = new JComboBox();
    jc.addItem("France");
    jc.addItem("Germany");
    jc.addItem("Italy");
    jc.addItem("Japan");
    jc.addItemListener(this);
    add(jc);/*  w w  w. j  ava 2  s .c  o m*/
    Action ac = jc.getAction();
}

From source file:Main.java

public Main() {
    JComboBox jc = new JComboBox();
    jc.addItem("France");
    jc.addItem("Germany");
    jc.addItem("Italy");
    jc.addItem("Japan");
    jc.addItemListener(this);
    add(jc);//w  w w . j a  va2  s  . com
    ComboBoxEditor editor = jc.getEditor();
}

From source file:Main.java

public Main() {
    JComboBox jc = new JComboBox();
    jc.addItem("France");
    jc.addItem("Germany");
    jc.addItem("Italy");
    jc.addItem("Japan");
    jc.addItemListener(this);
    add(jc);//from   w ww  .  j  av  a2 s .  c  o m
}

From source file:MainClass.java

public MainClass() {
    JComboBox jc = new JComboBox();
    jc.addItem("France");
    jc.addItem("Germany");
    jc.addItem("Italy");
    jc.addItem("Japan");
    jc.addItemListener(this);
    add(jc);//from   www .j  a  v a  2 s  .  co m
}

From source file:Main.java

public Main() {
    JComboBox jc = new JComboBox();
    jc.addItem("France");
    jc.addItem("Germany");
    jc.addItem("Italy");
    jc.addItem("Japan");
    jc.addItemListener(this);
    add(jc);//from   w w  w. ja v  a 2s . c  om

    ListCellRenderer render = jc.getRenderer();
}

From source file:Main.java

public Main() {
    JComboBox jc = new JComboBox();
    jc.addItem("France");
    jc.addItem("Germany");
    jc.addItem("Italy");
    jc.addItem("Japan");
    jc.addItemListener(this);
    add(jc);/*from   w w  w.  ja  va  2  s . co  m*/
    jc.firePopupMenuCanceled();

}