MainClass.java Source code

Java tutorial

Introduction

Here is the source code for MainClass.java

Source

import java.util.Vector;

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

public class MainClass extends JFrame {
    MainClass(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 MainClass("Combo box Demo1");
    }
}