Java tutorial
import java.awt.Dimension; import java.util.ArrayList; import java.util.List; import javax.swing.JList; import javax.swing.JOptionPane; import javax.swing.JScrollPane; public class Main { public static void main(String[] args) { List<String> list = new ArrayList<>(); for (int i = 0; i < 30; i++) { list.add("Hello, World " + i); } JScrollPane pane = new JScrollPane(new JList(list.toArray())) { @Override public Dimension getPreferredSize() { return new Dimension(200, 250); } }; JOptionPane.showMessageDialog(null, pane); } }