FileDocCategorySizeDatePackage
JComboBoxDemo.javaAPI DocExample1454Sun Jan 07 16:42:34 GMT 2001None

JComboBoxDemo

public class JComboBoxDemo extends JFrame

Fields Summary
Constructors Summary
public JComboBoxDemo()

    super("JComboBoxDemo");

    String [] items = {"Anthony", "Lorraine", "Marie"};
    JComboBox itemsComboBox = new JComboBox(items);
    itemsComboBox.setEditable(true);
    itemsComboBox.setMaximumRowCount(3);
    this.getContentPane().add(itemsComboBox);
    itemsComboBox.show();
    applyOrientation(this, ComponentOrientation.RIGHT_TO_LEFT);
    this.validate();
    this.repaint();
  
Methods Summary
private voidapplyOrientation(java.awt.Component c, java.awt.ComponentOrientation o)

    c.setComponentOrientation(o);

    if (c instanceof JMenu) {
      JMenu menu = (JMenu)c;
      int ncomponents = menu.getMenuComponentCount();
      for (int i = 0; i < ncomponents; ++i) {
        applyOrientation(menu.getMenuComponent(i), o);
      }
    } else if (c instanceof Container) {
      Container container = (Container)c;
      int ncomponents = container.getComponentCount();
      for (int i = 0; i < ncomponents; ++i) {
        applyOrientation(container.getComponent(i), o);
      }
    }
  
public static voidmain(java.lang.String[] args)

    JFrame frame = new JComboBoxDemo();
    frame.addWindowListener(new WindowAdapter() {
      public void windowClosing(WindowEvent e) {System.exit(0);}
    });

    frame.pack();
    frame.setVisible(true);