Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import java.util.Vector;

import javax.swing.JComboBox;
import javax.swing.JFrame;

public class Main extends JFrame {
    Main(String title) {
        super(title);

        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

        Vector v = new Vector();
        v.add("A");
        v.add("B");
        v.add("C");
        JComboBox jcb = new JComboBox(v);

        getContentPane().add(jcb);

        setSize(200, 50);
        setVisible(true);
    }

    public static void main(String[] args) {
        new Main("Combo box Demo1");
    }
}