Friday, November 21, 2014

JList: How to create list in java swing.

To show list of items in java swing, we have a javax.swing.JList component.
Following steps needed to create list
1. Create list of items as String array.
2. Create instance of a JPanel
3. create the object of JList by passing items array as parameter to its constructor.
4. Now add the instance of JList to panel.
5. add the panel to your frame
6. set the size and visibility of your frame.
7. Test your program.
or watch the following video that i have uploaded for easy reference.