Creating a combo box and add items to it - Java Swing

Java examples for Swing:JComboBox

Description

Creating a combo box and add items to it

Demo Code

import javax.swing.JComboBox;

public class Main {
  public static void main(String[] args) {
    JComboBox combo1 = new JComboBox();

    combo1.addItem("A");
    combo1.addItem("B");
    combo1.addItem("C");
    combo1.addItem("D");
    combo1.addItem("E");
    combo1.addItem("F");
    combo1.addItem("G");
  }/*from   w ww.j a  v  a  2s. c om*/
}

Related Tutorials