The items can be arbitrary objects. The toString() method of the objects is displayed in the list component. : JList Renderer « Swing « Java Tutorial






import javax.swing.JList;

public class Main {
  public static void main(String[] argv) throws Exception {
    Object[] items2 = { new Integer(123), new java.util.Date() };
    JList list = new JList(items2);
    
    
  }
}








14.41.JList Renderer
14.41.1.Rendering JList Elements
14.41.2.Install List cell rendererInstall List cell renderer
14.41.3.Add your own ListCellRendererAdd your own ListCellRenderer
14.41.4.Creating a Complex ListCellRenderer: font, icon and colorCreating a Complex ListCellRenderer: font, icon and color
14.41.5.The items can be arbitrary objects. The toString() method of the objects is displayed in the list component.
14.41.6.Setting the Dimensions of an Item in a JList Component
14.41.7.Set the item dimensions using a sample value
14.41.8.Change the layout orientation so that its items are displayed top-to-bottom and left-to-right.