JList box java

We are going to describe JList box java. First of all we have created JList component of Swing. List is a component of GUI() Graphical User Interface.


 

Ads

Tutorials   
Ads

JList box java

We are going to describe JList box java. First of all we have created JList component of Swing. List is a component of GUI() Graphical User Interface. It allows the multiple items in a list and In this class extend the JComponent class in Swing. We can use select item from the combo box because you can select more than one item at once from the list.

Example of JList:-

package List;

import javax.swing.*;

public class ListExample {
	public static void main(String[] args) {
		String list1[] = { "List", "List1", "List2", "List3" };
		JFrame frame = new JFrame("Creating a JList box");
		JPanel panel = new JPanel();
		frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		JList list = new JList(list1);
		frame.setUndecorated(true);
		frame.getRootPane().setWindowDecorationStyle(JRootPane.PLAIN_DIALOG);
		panel.add(list);
		frame.add(panel);
		frame.setSize(300, 200);
		frame.setVisible(true);
	   }
     }

output:-

Download Source Code

Advertisements

Ads
Share on Google+Share on Google+

JList box java

Posted on: July 16, 2013 If you enjoyed this post then why not add us on Google+? Add us to your Circles

Advertisements

 

Discuss: JList box java  

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 
Comments:0

Ads

 

Ads