Java Swing Tutorial - Java JComboBox .setPopupVisible (boolean v)








Syntax

JComboBox.setPopupVisible(boolean v) has the following syntax.

public void setPopupVisible(boolean v)

Example

In the following code shows how to use JComboBox.setPopupVisible(boolean v) method.

/*  w w w .j  a  v a  2  s  .c om*/
import javax.swing.JComboBox;

public class Main {
  public static void main(String[] argv) throws Exception {
    String[] items = { "item1", "item2" };
    JComboBox cb = new JComboBox(items);

    cb.setPopupVisible(true);
  }
}