Source Code : ComboBox Sample

Java Is Open Source Programming Language You Can Download From Java and Java Libraries From http://www.oracle.com. Click Here to download
We provide this code related to title for you to solve your developing problem easily. Libraries which is import in this program you can download from http://www.oracle.com. Click Here or search from google with Libraries Name you get jar file related it

ComboBox Sample

ComboBox Sample
  
import java.awt.BorderLayout;
import java.awt.Container;

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

public class ComboBoxSample {
  public static void main(String args[]) {
    String labels[] = { "A", "B", "C", "D","E", "F", "G", "H","I", "J" };

    String title = (args.length == 0 ? "Example JComboBox" : args[0]);
    JFrame frame = new JFrame(title);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    Container contentpane = frame.getContentPane();

    JComboBox comboBox1 = new JComboBox(labels);
    comboBox1.setMaximumRowCount(5);
    contentpane.add(comboBox1, BorderLayout.NORTH);

    JComboBox comboBox2 = new JComboBox(labels);
    comboBox2.setEditable(true);
    contentpane.add(comboBox2, BorderLayout.SOUTH);

    frame.setSize(300, 200);
    frame.setVisible(true);
  }
}



           
         
    
  

Thank with us