richard: Application zu Applet--Wie nur?

Beitrag lesen

Modifizierte SourceKlasse (TreeTableExample0.java) :

/*
 * %W% %E%
 *
 * Copyright 1997, 1998 Sun Microsystems, Inc. All Rights Reserved.
*/

//import com.sun.java.swing.*;
import javax.swing.*;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.awt.Dimension;

/**
 * A TreeTable example, showing a JTreeTable, operating on the
 * local file system.
 *
 * @version %I% %G%
 *
 * @author Philip Milne
 * edited Richard Holderied
 */

public class TreeTableExample0
    extends java.applet.Applet {
  public void init() {
    JFrame frame = new JFrame("TreeTable");
    JTreeTable treeTable = new JTreeTable(new FileSystemModel());

frame.getContentPane().add(new JScrollPane(treeTable));

UIManager.LookAndFeelInfo[] lafs = UIManager.getInstalledLookAndFeels();
    int rightLook = 0;
    for (int count = 0; count < lafs.length; count++) {
      String myString = lafs[count].getName();
      if (myString == "Windows") {
        rightLook = count;
      }
    }

UIManager.LookAndFeelInfo info = lafs[rightLook];
    try {
      UIManager.setLookAndFeel(info.getClassName());
      SwingUtilities.updateComponentTreeUI(frame);
    }
    catch (Exception e) {
      System.err.println("unable to set UI " +
                         e.getMessage());
    }

this.setSize(new Dimension(600, 400));
    this.add(frame);
  }
}

Alle weiteren (unmodifiziert) verwendeten Klassen stehen bei:
http://java.sun.com/products/jfc/tsc/articles/treetable1/index.html
Namentlich:
 AbstractCellEditor.java
 AbstractTreeTableModel.java
 FileSystemModel.java
 JTreeTable.java
 MergeSort.java
 TreeTableModel.java
 TreeTableModelAdapter.java

Ich danke für die Hilfe,
Richard