Example usage for javax.swing JComboBox JComboBox

List of usage examples for javax.swing JComboBox JComboBox

Introduction

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

Prototype

public JComboBox() 

Source Link

Document

Creates a JComboBox with a default data model.

Usage

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  a v a 2 s  . c o m

    System.out.println(jc.isLightWeightPopupEnabled());
}

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.  ja v  a  2  s. co m*/

    System.out.println(jc.isEditable());
}

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  .ja  v a  2  s.co  m*/

    Object[] objs = jc.getSelectedObjects();
}

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.ja v  a 2 s. c  o m*/

    PopupMenuListener[] pop = jc.getPopupMenuListeners();

}

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  a  va 2s .c o  m*/

    AccessibleContext ac = jc.getAccessibleContext();
}

From source file:Main.java

public Main() {
    JComboBox comboBox = new JComboBox();

    setListCellRendererOf(comboBox);/*w  w  w  . ja  va2 s .com*/

    comboBox.addItem("A");
    comboBox.addItem("B");
    comboBox.addItem("C");

    getContentPane().add(comboBox, "North");
    setSize(200, 100);
    setDefaultCloseOperation(EXIT_ON_CLOSE);
}

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  av  a2 s.co m
}

From source file:Main.java

public Main() {
    setPreferredSize(new Dimension(320, 240));
    setBackground(hue.getColor());/*from w w w . ja  va 2 s .c om*/
    JComboBox colorBox = new JComboBox();
    for (Hue h : Hue.values()) {
        colorBox.addItem(h);
    }
    colorBox.addActionListener(e -> {
        Hue h = (Hue) colorBox.getSelectedItem();
        Main.this.setBackground(h.getColor());
    });
    this.add(colorBox);
}

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);// www . jav  a 2  s .  c om

    jc.showPopup();
}

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 ww . j a v  a 2 s.c  om*/

    jc.firePopupMenuWillBecomeVisible();
}