//Titel:        JTree
//Version:       1.0
//Copyright:     Copyright (c) 2003, 06
//Autor:         Dipl.-Inf., Dipl.-Ing. (FH) Michael Wilhelm
//Organisation:  HS Harz
//Beschreibung:  Einführung in JTree

// Beispiel mit JTree, DefaultMutableTreeNode

import java.awt.*;
import javax.swing.*;

import java.awt.event.*;

import javax.swing.tree.DefaultMutableTreeNode;


public class Tree01 extends JFrame {

  JTree jTree1;

  public Tree01() {
    setGUI();
  }

  private void setGUI()  {

    setSize(400, 300);
    setTitle("JTree 1. Beispiel");
    this.getContentPane().setLayout( new BorderLayout() );

    jTree1 = new javax.swing.JTree();
    jTree1.setFont( new Font("Arial", Font.BOLD,18)  );

    this.getContentPane().add(jTree1, BorderLayout.CENTER);
    // Neue Version
    // setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  } // setGUI



  //Überschreiben, damit das Programm bei Herunterfahren des Systems beendet werden kann
  protected void processWindowEvent(WindowEvent e) {
    super.processWindowEvent(e);
    if(e.getID() == WindowEvent.WINDOW_CLOSING) {
      System.exit(0);
    }
  }


  public static void main(String[] args) {
    Tree01 frame = new Tree01();
    frame.setVisible(true);
 }


}  // 1. Beispiel


