salve a tutti
io ho un problema con java
non riesco a far visualizzare dentro un JDesktopPane una classe che deriva JInternalFrame
ecco il codice della classe che ha JDesktopPane

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.tree.*;
import javax.swing.event.*;
import java.lang.reflect.*;
import java.util.*;

public class Menu
{
public static void main(String[] args)
{
JFrame frame = new MenuFrame();

frame.show();
}
}

class MenuFrame extends JFrame implements TreeSelectionListener
{
public MenuFrame()
{
setTitle("Menu");
setSize(400,300);
addWindowListener
(
new WindowAdapter()
{
public void windowClosing(WindowEvent e)
{
System.exit(0);
}

}
);


//costruisce l'albero
TreeNode root = makeTree();
model = new DefaultTreeModel(root);
tree = new JTree(model);
//tree.setEditable(true);
//tree.setRootVisible(false);

//imposta modalità di selezione
tree.addTreeSelectionListener(this);
int mode = TreeSelectionModel.SINGLE_TREE_SELECTION;
tree.getSelectionModel().setSelectionMode(mode);

JDesktopPane command = new JDesktopPane();

JSplitPane splitPane;
JPanel albero = new JPanel();
albero.setLayout(new GridLayout(1, 2));
albero.add(new JScrollPane(tree));

splitPane = new JSplitPane( JSplitPane.HORIZONTAL_SPLIT, albero, command );
splitPane.setOneTouchExpandable( true );
splitPane.setDividerLocation( 150 );
splitPane.setContinuousLayout(true);
splitPane.setOneTouchExpandable(true);


//aggiunge riquadro di scorrimento e vi inserisce l'albero
Container contentPane = getContentPane();

contentPane.add(splitPane, "Center");

}
public void valueChanged(TreeSelectionEvent event) {
try
{
String face = tree.getLastSelectedPathComponent().toString();
Class cls = Class.forName(face);
command.add(new JScrollPane((JComponent)cls.newInstance()));

}catch(Exception e)

{e.printStackTrace();}

}

public TreeNode makeTree()
{
..........................
}


private DefaultTreeModel model;
private JTree tree;
private JDesktopPane command;




}



ecco il codice della classe che viene chiamata:



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

public class Copy extends JInternalFrame {
public static void main(String[] args) {
new Copy();
}

private JList sampleJList;
private JTextField valueField;

private JButton button;

public Copy() {
//super("Copy");

JInternalFrame copy = new JInternalFrame("Copy ",true,true,true,true);
copy.setSize(200,200);
copy.setVisible(true);


WindowUtilities.setNativeLookAndFeel();
//addInternalFrameListener(new ExitListener());
Container content = getContentPane();

// Create the JList, set the number of visible rows, add a
// listener, and put it in a JScrollPane.
String[] entries = { "Entry 1", "Entry 2", "Entry 3",
"Entry 4", "Entry 5", "Entry 6" };
sampleJList = new JList(entries);
sampleJList.setVisibleRowCount(4);
Font displayFont = new Font("century gothic", Font.BOLD, 12);
sampleJList.setFont(displayFont);
sampleJList.addListSelectionListener(new ValueReporter());
JScrollPane listPane = new JScrollPane(sampleJList);

JPanel listPanel = new JPanel();
listPanel.setBackground(Color.white);
Border listPanelBorder =
BorderFactory.createTitledBorder("Copy file");
listPanel.setBorder(listPanelBorder);
listPanel.add(listPane);
content.add(listPanel, BorderLayout.CENTER);

JLabel valueLabel = new JLabel("New name:");
valueLabel.setFont(displayFont);
valueField = new JTextField("None", 20);
valueField.setFont(displayFont);



button = new JButton("Copy");

JPanel valuePanel = new JPanel(new GridLayout(4, 1, 2, 2));
valuePanel.setBackground(Color.white);
//Border valuePanelBorder =
// BorderFactory.createTitledBorder("Edit Selection");
//valuePanel.setBorder(valuePanelBorder);
valuePanel.add(valueLabel);
valuePanel.add(valueField);



valuePanel.add(button);

content.add(valuePanel, BorderLayout.SOUTH);
pack();
setVisible(true);

}

private class ValueReporter implements ListSelectionListener {
public void valueChanged(ListSelectionEvent event) {
if (!event.getValueIsAdjusting())
valueField.setText(sampleJList.getSelectedValue(). toString());
}
}
}

qualcuno sarebbe così gentile da dirmi dove sbaglio


grazie mille