Java 8일차 List 테스트

import javax.swing.JFrame;
import javax.swing.JList;

public class ListTest extends JFrame
{
JList<String> list;
String items[] = {"반복문","for","while","do-while"};

public ListTest()
{
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.setSize(300, 200);
this.setVisible(true);

list = new JList<>(items);

add(list, "North");
}

public static void main(String[] args)
{
new ListTest();
}
}

result)


댓글 없음: