Source Code : PopupCombo 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
PopupCombo Sample

import java.awt.BorderLayout;
import java.awt.Container;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JComponent;
import javax.swing.JFrame;
import javax.swing.plaf.ComboBoxUI;
import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.basic.BasicArrowButton;
import javax.swing.plaf.basic.BasicComboBoxUI;
public class PopupComboSample {
public static void main(String args[]) {
String labels[] = { "A", "B", "C", "D","E", "F", "G", "H","I", "J" };
JFrame frame = new JFrame("Popup JComboBox");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Container contentPane = frame.getContentPane();
JComboBox comboBox = new JComboBox(labels);
comboBox.setMaximumRowCount(5);
comboBox.setUI((ComboBoxUI) MyComboBoxUI.createUI(comboBox));
contentPane.add(comboBox, BorderLayout.NORTH);
frame.setSize(300, 200);
frame.setVisible(true);
comboBox.showPopup();
}
static class MyComboBoxUI extends BasicComboBoxUI {
public static ComponentUI createUI(JComponent c) {
return new MyComboBoxUI();
}
protected JButton createArrowButton() {
JButton button = new BasicArrowButton(BasicArrowButton.EAST);
return button;
}
}
}
Thank with us