Combobox in Frame

import javax.swing.*;

public class FrameDemo7 extends JFrame {
	public FrameDemo7() {
		super("techmyguru.com");
		setSize(500, 600);
		getContentPane().add(new PanelSelectionBox());
		setDefaultCloseOperation(EXIT_ON_CLOSE);
		setVisible(true);
	}

	public static void main(String[] args) {
		new FrameDemo7();
	}
}

Download

PanelSelectionBox.java

import javax.swing.*;

public class PanelSelectionBox extends JPanel {
	JList list;
	String str[] = { "One", "Two", "Three", "Four", "Five", "Six", "Seven",
			"Eight", "Nine", "Ten" };
	String str1[] = { "One", "Two", "Three", "Four", "Five", "Six", "Seven",
			"Eight", "Nine", "Ten" };
	JScrollPane sp;
	JComboBox box;

	public PanelSelectionBox() {
		super();
		list = new JList(str);
		list.setSelectedIndex(0);
		sp = new JScrollPane(list);
		list.setVisibleRowCount(4);
		add(sp);
		add(box = new JComboBox(str1));
	}
}

Download

Frame in Swing

Simple Frame
Frame with Panel
Frame Menu Event ans Color Chooser
Frame with Panel and Button
TextField and TextArea
Combobox in Frame
Change Icon of Frame
Scrollbar in Frame
Scrollbar in Frame
Add picture in Frame
Label in Frame
Toggle Buttons in frame
Radio Buttons in Frame


Write your Comment

Name :
Email Id : [ We will not publish your email id ]
Your Comment : [ Maximum 200 chars ]
Enter Security code