Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.JTree;

public class Main extends JFrame {

    public static void main(String[] args) {
        Main stt = new Main();
        stt.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        stt.setSize(250, 250);
        stt.setVisible(true);
    }

    public Main() {
        Object[] genealogy = { "A", "B", "C", "D", "E", "F" };
        java.util.Vector v = new java.util.Vector() {
            public String toString() {
                return "DD";
            }
        };
        v.addElement("1");
        v.addElement("2");
        v.addElement("3");
        v.addElement("4");
        genealogy[0] = v;
        JTree tree = new JTree(genealogy);
        tree.setRootVisible(true);
        JScrollPane jsp = new JScrollPane(tree);
        getContentPane().add(jsp);
    }

}