Sample java Combo box

import java.awt.*;
public class sampleComboBox extends Frame {

public sampleComboBox() {

setSize(400,150);
show();

Choice ch = new Choice();
//ch.addItemListener(this);

ch.addItem("First ");
ch.addItem("Second");
ch.addItem("Third ");
ch.addItem("Fourth");
ch.addItem("Fifth ");
setLayout(null);
ch.setBounds(150,100,80,50);
add(ch);

}

public static void main(String[] args) {

new Choices();
}
}

0 comments: