Create JComboBox using a Vector of String as the list of choices - Java Swing

Java examples for Swing:JComboBox

Description

Create JComboBox using a Vector of String as the list of choices

Demo Code

import java.util.Vector;

import javax.swing.JComboBox;

public class Main {

  public static void main(String[] args) {
    Vector<String> sList2 = new Vector<>(4);
    sList2.add("Spring");
    sList2.add("Summer");
    sList2.add("Fall");
    sList2.add("Winter");
    JComboBox<String> seasons2 = new JComboBox<>(sList2);
  }/*from  ww w.  ja  va 2s  . c  o m*/
}

Related Tutorials