ComboBox in Java

ComboBox in Java
1.72 KB 55 Downloads 1 Files
Download
or download free
[free_download_btn]

ComboBox in Java

A gui program in java that demonstrate how to add a combo box in a window. The program uses swing library. JComboBox is one of the component of swing library.

Source code:

import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.JPanel;


public class ComboBoxInJava extends JFrame {
	
	private JComboBox jcombo;
	private JPanel myjpanel;
	private String[] comboboxitem;
	
	public ComboBoxInJava(){
		
		myjpanel =new JPanel();
		
		comboboxitem = new String[]{"Java", "Visual Basic", "VB.net", "C#", "PHP"};

        jcombo = new JComboBox<>(comboboxitem);
        
       	add(jcombo);
  		
		}	
	
	public static void main (String args[]){
		ComboBoxInJava gui = new ComboBoxInJava();
		gui.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		gui.setTitle("Java GUI");
		gui.setSize(150,90);
		gui.setVisible(true);
		
	}
}
[changelog]

Categories & Tags

Similar Downloads

No related download found!
, , , , , ,

Post navigation

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.