Home Swing JList box java

Related Tutorials


 
 

Share on Google+Share on Google+

JList box java

Advertisement
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.

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

Advertisement


Liked it!  Share this Tutorial


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: July 16, 2013

Related Tutorials

Discuss: JList box java  

Post your Comment


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