Create a JList using a Vector - Java Swing

Java examples for Swing:JList

Description

Create a JList using a Vector

Demo Code

import java.util.Vector;

import javax.swing.JList;

public class Main {

  public static void main(String[] args) {
    Vector<String> items2 = new Vector<>(4);
    items2.add("Spring");
    items2.add("Summer");
    items2.add("Fall");
    items2.add("Winter");
    JList<String> list2 = new JList<>(items2);
  }/*www .  j  a va2s . c  o m*/
}

Related Tutorials