public JList()
JList jlist = new JList();
public JList(Object listData[])
String labels[] = { "A", "B", "C", "D", "E", "F", "G", "H"};
JList jlist = new JList(labels);
public JList(Vector listData)
Vector vector = aBufferedImage.getSources();
JList jlist = new JList(vector);
public JList(ListModel model)
ResultSet results = aJDBCStatement.executeQuery("SELECT colName FROM tableName");
DefaultListModel model = new DefaultListModel();
while (result.next()){
model.addElement(result.getString(1));
}
JList jlist = new JList(model);
To improve performance, you can set the fixedCellHeight and fixedCellWidth properties.
Setting these properties is one way to avoid having the JList ask each cell for its rendered size.