public tree() {
JFrame f = new JFrame();
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JTree tree = new JTree();
DefaultMutableTreeNode rootNode =
new DefaultMutableTreeNode("Stundenpläne");
DefaultMutableTreeNode MeinStundenplan =
new DefaultMutableTreeNode("Mein Stundenplan");
rootNode.add(MeinStundenplan);
DefaultMutableTreeNode plaene =
new DefaultMutableTreeNode("Alle Pläne");
rootNode.add(plaene);
DefaultMutableTreeNode IWD = new DefaultMutableTreeNode("IWD");
plaene.add(IWD);
DefaultMutableTreeNode c = new DefaultMutableTreeNode("1.SemesterIWD");
IWD.add(c);
DefaultMutableTreeNode cc = new DefaultMutableTreeNode("2.SemesterIWD");
IWD.add(cc);
DefaultMutableTreeNode ccc = new DefaultMutableTreeNode("3.SemesterIWD");
IWD.add(ccc);
DefaultMutableTreeNode BMD = new DefaultMutableTreeNode("BMD");
plaene.add(BMD);
DefaultMutableTreeNode d = new DefaultMutableTreeNode("1.SemesterBMD");
BMD.add(d);
DefaultMutableTreeNode dd = new DefaultMutableTreeNode("2.SemesterBMD");
BMD.add(dd);
DefaultMutableTreeNode ddd = new DefaultMutableTreeNode("3.SemesterBMD");
BMD.add(ddd);
DefaultMutableTreeNode BMB = new DefaultMutableTreeNode("BMB");
plaene.add(BMB);
DefaultMutableTreeNode e = new DefaultMutableTreeNode("1.SemesterBMB");
BMB.add(e);
DefaultMutableTreeNode ee = new DefaultMutableTreeNode("2.SemesterBMB");
BMB.add(ee);
DefaultMutableTreeNode eee = new DefaultMutableTreeNode("3.SemesterBMB");
BMB.add(eee);
DefaultMutableTreeNode Prof = new DefaultMutableTreeNode("Prof");
rootNode.add(Prof);
DefaultMutableTreeNode b = b = new DefaultMutableTreeNode("Grudowski");
Prof.add(b);
b = new DefaultMutableTreeNode("Thies");
Prof.add(b);
b = new DefaultMutableTreeNode("Ratke");
Prof.add(b);
DefaultMutableTreeNode Room = new DefaultMutableTreeNode("Room");
rootNode.add(Room);
b = new DefaultMutableTreeNode("012");
Room.add(b);
b = new DefaultMutableTreeNode("014");
Room.add(b);
b = new DefaultMutableTreeNode("N412");
Room.add(b);
tree.setModel(new DefaultTreeModel(rootNode));
JScrollPane scrollTree = new JScrollPane(tree);
teiler = new JSplitPane();
JScrollPane scrolwelcome = new JScrollPane();
teiler.setLeftComponent(scrollTree);
teiler.setRightComponent(new JLabel("Stundenplaneditor von Stefan Knoepfle",JLabel.CENTER));
f.getContentPane().add(teiler);
/**Kontrolliert, dass nur ein Knoten makrkiert werden kann**/
TreeSelectionModel tsm = new DefaultTreeSelectionModel();
tsm.setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
tree.setSelectionModel(tsm);
tree.setRootVisible(true);
//Menüleiste
f.setJMenuBar(new Menueleiste());
f.setVisible(true);
/** Setzte Fenster Startposition */
f.setLocation(100, 150);
f.setResizable(false);
f.setSize(800, 600);
f.setVisible(true);
//events
tree.addTreeSelectionListener(new Baumlauscher());
}