Contoh JComboBox

package javaapplication1;
import java.awt.*;
import javax.swing.*;
public class Main extends JFrame{
    private JLabel jLabel =new JLabel("jenis kelamin: ");
    private JComboBox jComboBox = new JComboBox();
    private Container c = new Container();
    public Main(){
        super("contoh JComboBox");
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        setLocation(200,200);
        setSize(210,90);

        jComboBox.addItem("Laiki-Laki");
        jComboBox.addItem("Perempuan");

        c = getContentPane();
        c.setLayout(new FlowLayout());
        c.add(jLabel);
        c.add(jComboBox);

        setVisible(true);
        }
public static void main(String[] args) {
    new Main();
}
}

Diberdayakan oleh Blogger.
Twitter Delicious Facebook Digg Stumbleupon Favorites More