Declarar uma JDesktopPane dentro de uma classe anônima ActionListener ActionPerformed

estou tentando inserir uma JInternalFrame(TelaUsuario) em uma JDesktopPane(da tela principal) esse é o método construtor

            JDesktopPane desktopPane = new JDesktopPane();
	desktopPane.setBounds(0, 0, 674, 497);
	contentPane.add(desktopPane);

é essa é a classe anônima eu acho

                       JMenuItem mntUsuario = new JMenuItem("Usuario");
	         mntUsuario.addActionListener(new ActionListener() {
                       public void actionPerformed(ActionEvent e) {
			
			 TelaUsuario usuario = new TelaUsuario();
			  desktopPane.add(usuario);
			usuario.setVisible(true);
				
		}
	});

desktopPane não reconhecido.

como fazer nesse caso para declarar em uma classe anônima?

No Netbeans reconhece no eclipse não

Estranho, se reconheceu no netbeans, tem que reconhecer no eclipse. Afinal, a linguagem e a sintaxe são a mesma. O código é o mesmo que vc está tentando abrir nas duas IDEs?

Oi Lucas, obrigado pela resposta. tem uma diferença que me parece é o método actionListener que vem automático quando faço o actionPerformed no item do menu para abrir o JIntenalFrame dentro do JDesktop

Pelo que vi em fóruns o método/classe actionListener é um método anônimo por isso não reconhece variáveis ou objetos de construtores fora dela(foi o que eu entendi). Mas não peguei como declarar variáveis dentro do actionListener então.

código no netbeans:

public class TelaPrincipal extends javax.swing.JFrame {
    
    Connection conexao = null;
    PreparedStatement pst = null;
    ResultSet rs = null;
    Appcon appcon = new Appcon();

 
    public TelaPrincipal() {
        initComponents();
        conexao = appcon.connect(); 
}                             
                                 

    private void MenCadUsuActionPerformed(java.awt.event.ActionEvent evt) {                                          
   TelaUsuario usuario = new TelaUsuario();

   desktop.add(usuario);           // Aqui ele reconhece normal

   usuario.setVisible(true);
}                                   

desktop reconhecido normalmente!

agora
código do eclipse com o método actionListener

public class TelaPrincipal extends JFrame {

	private JPanel Menu;
	
	 Connection conexao = null;
	 PreparedStatement pst = null;
	 ResultSet rs = null;
	 Appconn appconn = new Appconn();
	
	public static void main(String[] args) {
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					TelaPrincipal frame = new TelaPrincipal();
					frame.setVisible(true);
					
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});


public TelaPrincipal() {

setResizable(false);
		setTitle("X - Sistema para controle de OS");
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setBounds(100, 100, 880, 558);
		
		JMenuBar menuBar = new JMenuBar();
		setJMenuBar(menuBar);
		
		JMenu mnCadastro = new JMenu("Cadastro");
		menuBar.add(mnCadastro);
		
		JMenuItem mntClientes = new JMenuItem("Clientes");
		mnCadastro.add(mntClientes);
		
		JMenuItem mntOS = new JMenuItem("OS");
		mnCadastro.add(mntOS);
		
		JMenuItem mntUsuario = new JMenuItem("Usuario");
		mntUsuario.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				
				TelaUsuario usuario = new TelaUsuario();
				desktop.add(usuario);   // aqui não reconhece(dentro do ActionListener)
				usuario.setClosable(true);
				usuario.setIconifiable(true);
				usuario.setMaximizable(true);
				usuario.setVisible(true);
					
			}
		});


               JDesktopPane desktop = new JDesktopPane();  //método construtor
		desktop.setBounds(20, 23, 661, 463);
		Menu.add(desktop);

  }
}

Já tentei acompanhar tutoriais de video mas poucos são com eclipse e não são exatamente inserir uma JInternaFrame em um JDesktop atraves de uma actionListener/ActionPerformed no item do menu.

Se alguém souber como fazer a declaração do desktop dentro do método anônimo ActionListener/ActionPerformed fico muito agradecido. Valeu

Coloque o JDesktopPane como final:

final JDesktopPane desktop = new JDesktopPane();

No código que está no netbeans vc não postou como está declarado o JDesktopPane, mas provavelmente está como final.

não mudou, abri e fechei pra ver se reconhecia, nada

no netbeans não tem o método construtor para o JDesktopPane,
mas tem uns códigos que gera automaticamente que são minimizados e com mensagem para não serem modificados exemplo

@SuppressWarnings(“unchecked”)

dentro o desktop está assim

javax.swing.GroupLayout desktopLayout = new javax.swing.GroupLayout(desktop);
desktop.setLayout(desktopLayout);
desktopLayout.setHorizontalGroup(
desktopLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 630, Short.MAX_VALUE)
);

não faço a menor ideia do que significa só sei que no netbeans reconhece o desktop dentro do actionPerformed. E no eclipse nem dentro nem fora do actionPerformed, já tentei construir um método dentro do public TelaPrincipal() e chamar o método. mas qualquer public void que vc coloca já da erro, daí tentei fora no public class TelaPrincipal extends JFrame. O método é aceito só não reconhece o desktop. Tentei agora de novo com o final, mesma coisa.

Não tem diferença se vc está no eclipse, netbeans, intellij, ou qualquer que seja a IDE. Tem alguma coisa que está diferente no código. Se o código está implementado correto, tem que funcionar em qualquer IDE.

O código apresenta algum erro de compilação no eclipse para vc? (alguma marcação em vermelho)

então só o do desktop.add(usuario) dentro do ActionPerformed.

JMenuItem mntUsuario = new JMenuItem(“Usuario”);
mntUsuario.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {

			TelaUsuario usuario = new TelaUsuario();
			
			desktop.add(usuario); // erro em vermelho no desktop
			usuario.setClosable(true);
			usuario.setIconifiable(true);
			usuario.setMaximizable(true);
			usuario.setVisible(true);
				
		}
	});

dai poem o mouse na lampada com x a esquerda e fala:

desktop can not be resolved.

daí clica para ver as sugestões, a primeira a atribuir desktop a um Conteiner já fiz isso e outras sugestões, nada.

já coloquei o construror dentro do actionPerformed, funciona mas vc fecha e abre o Jinternal frame denovo da problema, e eu vi em um fórum que isso não pode fazer. Mas eu to travado aqui. acho que vou assistir a aula do professor José de Assis de novo onde ele explica como ele fez no netbeans ver se descubro algo diferente ou fora do convencional que ele fez lá.

Porque é uma coisa razoavelmente simples vc cria um JFrame(TelaPrincipal) dentro vc cria um JDesktopPane(desktop) e depois cria as JInternalFrames(TelaUsuario), vai no menu clica com botão direito no JMenuItem(Usuario) e cria um ActionPerformed para abrir o JInternalFrame(TelaUsuario) dentro do desktop.

desktop.add(usuario) //desktop em vermelho

alguma coisa esta configurada diferente do eclipse que não reconhece o desktop. eu achei que fosse o método ActionListener que não vi no netbeans.

Mas deveria ser fácil só usei as ferramentas de swing do eclipse.

Tem sim, você que não está visualizando, provavelmente o netbeans “esconde”.

Expande esses códigos e posta o código completo da sua tela.

Bora estudar a documentação dessas classes então. :wink:

1 curtida

staroski valeu pela resposta.

eu não tinha postado o código inteiro pois ele tá completo com toadas as JINternalFrames, Achei que ia ficar confuso.

Mas taí o código no netbeans: em seguida o do eclipse

package br.com.infox.telas;

import br.com.infox.dal.Appcon;
import br.com.infox.dal.ModuloConexao;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.text.DateFormat;
import java.time.LocalTime;
import java.util.Date;
import javax.swing.JOptionPane;
import javax.swing.JTextField;

/**
 *
 * @author mdemo
 */
public class TelaPrincipal extends javax.swing.JFrame {
    
    Connection conexao = null;
    PreparedStatement pst = null;
    ResultSet rs = null;
    public static String exemplo;
    Appcon appcon = new Appcon();

    /**
     * Creates new form TelaPrincipal
     */
    public TelaPrincipal() {
        initComponents();
        conexao = appcon.connect();    
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">                          
    private void initComponents() {

        jLabel1 = new javax.swing.JLabel();
        desktop = new javax.swing.JDesktopPane();
        jLabel3 = new javax.swing.JLabel();
        lblUsuario = new javax.swing.JLabel();
        lblData = new javax.swing.JLabel();
        Menu = new javax.swing.JMenuBar();
        MenCad = new javax.swing.JMenu();
        MenCadCli = new javax.swing.JMenuItem();
        MenCadOS = new javax.swing.JMenuItem();
        MenCadUsu = new javax.swing.JMenuItem();
        MenRel = new javax.swing.JMenu();
        MenRelServ = new javax.swing.JMenuItem();
        MenAju = new javax.swing.JMenu();
        MenAjuSob = new javax.swing.JMenuItem();
        MenOpc = new javax.swing.JMenu();
        MenOpcSai = new javax.swing.JMenuItem();

        jLabel1.setText("jLabel1");

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("X - Sistema para controle de OS");
        setResizable(false);
        addWindowListener(new java.awt.event.WindowAdapter() {
            public void windowActivated(java.awt.event.WindowEvent evt) {
                formWindowActivated(evt);
            }
            public void windowOpened(java.awt.event.WindowEvent evt) {
                formWindowOpened(evt);
            }
        });

        javax.swing.GroupLayout desktopLayout = new javax.swing.GroupLayout(desktop);
        desktop.setLayout(desktopLayout);
        desktopLayout.setHorizontalGroup(
            desktopLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 630, Short.MAX_VALUE)
        );
        desktopLayout.setVerticalGroup(
            desktopLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 480, Short.MAX_VALUE)
        );

        jLabel3.setIcon(new javax.swing.ImageIcon(getClass().getResource("/br/com/infox/icones/X1.png"))); // NOI18N

        lblUsuario.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
        lblUsuario.setText("Usuário");

        lblData.setFont(new java.awt.Font("Tahoma", 1, 24)); // NOI18N
        lblData.setText("Data");

        MenCad.setText("Cadastro");

        MenCadCli.setText("Clientes");
        MenCadCli.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                MenCadCliActionPerformed(evt);
            }
        });
        MenCad.add(MenCadCli);

        MenCadOS.setText("OS");
        MenCadOS.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                MenCadOSActionPerformed(evt);
            }
        });
        MenCad.add(MenCadOS);

        MenCadUsu.setText("Usuários");
        MenCadUsu.setEnabled(false);
        MenCadUsu.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                MenCadUsuActionPerformed(evt);
            }
        });
        MenCad.add(MenCadUsu);

        Menu.add(MenCad);

        MenRel.setText("Relatório");
        MenRel.setEnabled(false);

        MenRelServ.setText("Serviços");
        MenRel.add(MenRelServ);

        Menu.add(MenRel);

        MenAju.setText("Ajuda");
        MenAju.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                MenAjuActionPerformed(evt);
            }
        });

        MenAjuSob.setText("Sobre");
        MenAjuSob.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                MenAjuSobActionPerformed(evt);
            }
        });
        MenAju.add(MenAjuSob);

        Menu.add(MenAju);

        MenOpc.setText("Opções");

        MenOpcSai.setText("Sair");
        MenOpcSai.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                MenOpcSaiActionPerformed(evt);
            }
        });
        MenOpc.add(MenOpcSai);

        Menu.add(MenOpc);

        setJMenuBar(Menu);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(desktop, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGap(53, 53, 53)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(lblUsuario)
                            .addComponent(lblData)))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(28, 28, 28)
                        .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 159, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(42, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(desktop, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(48, 48, 48)
                        .addComponent(lblUsuario, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(lblData)
                        .addGap(67, 67, 67)
                        .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 162, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        setSize(new java.awt.Dimension(875, 556));
        setLocationRelativeTo(null);
    }// </editor-fold>                        

    private void formWindowActivated(java.awt.event.WindowEvent evt) {                                     
        Date data = new Date();
        DateFormat formatador = DateFormat.getDateInstance(DateFormat.SHORT);
        lblData.setText(formatador.format(data));
        
    }                                    

    private void MenOpcSaiActionPerformed(java.awt.event.ActionEvent evt) {                                          
        int sair = JOptionPane.showConfirmDialog(null,"Tem certeza que deseja sair?", "Atenção",JOptionPane.YES_NO_OPTION);
        if (sair == JOptionPane.YES_OPTION){
            System.exit(0);
        }
    }                                         

    private void MenAjuActionPerformed(java.awt.event.ActionEvent evt) {                                       

    }                                      

    private void MenAjuSobActionPerformed(java.awt.event.ActionEvent evt) {                                          
      TelaSobre sobre = new TelaSobre();
      sobre.setVisible(true);
    }                                         

    private void MenCadUsuActionPerformed(java.awt.event.ActionEvent evt) {                                          
   TelaUsuario usuario = new TelaUsuario();
   desktop.add(usuario);         **// aqui desktop é reconhecido normal**
   usuario.setVisible(true);

      
    }                                         

    private void MenCadCliActionPerformed(java.awt.event.ActionEvent evt) {                                          
       TelaClientes cliente = new TelaClientes();
       cliente.setVisible(true);
       desktop.add(cliente);
       
    }                                         

    private void MenCadOSActionPerformed(java.awt.event.ActionEvent evt) {                                         
        //chama a tela OS
        
        TelaOS os = new TelaOS();
        os.setVisible(true);
        desktop.add(os);
        
    }                                        

    private void formWindowOpened(java.awt.event.WindowEvent evt) {                                  
        String sql ="insert into fpTime (vendedor) values (?)";
        try {
             pst=conexao.prepareStatement(sql);
             pst.setString(1, exemplo);
             pst.executeUpdate();
             
             
        } catch (Exception e) {
            JOptionPane.showMessageDialog(null, e);
        }
       
    }                                 

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(TelaPrincipal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(TelaPrincipal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(TelaPrincipal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(TelaPrincipal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new TelaPrincipal().setVisible(true);
                
            }
        });
    }

    // Variables declaration - do not modify                     
    private javax.swing.JMenu MenAju;
    private javax.swing.JMenuItem MenAjuSob;
    private javax.swing.JMenu MenCad;
    private javax.swing.JMenuItem MenCadCli;
    private javax.swing.JMenuItem MenCadOS;
    public static javax.swing.JMenuItem MenCadUsu;
    private javax.swing.JMenu MenOpc;
    private javax.swing.JMenuItem MenOpcSai;
    public static javax.swing.JMenu MenRel;
    private javax.swing.JMenuItem MenRelServ;
    private javax.swing.JMenuBar Menu;
    private javax.swing.JDesktopPane desktop;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel lblData;
    public static javax.swing.JLabel lblUsuario;
    // End of variables declaration                   

}

agora o código do eclipse:

package br.com.infox.telas;

import java.awt.BorderLayout;

import java.util.Date;
import java.awt.EventQueue;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;

import br.com.infox.dal.Appconn;

import javax.swing.JMenuBar;
import javax.swing.JLabel;
import javax.swing.JMenu;
import javax.swing.JMenuItem;
import javax.swing.JOptionPane;
import javax.swing.SwingConstants;
import javax.swing.JDesktopPane;
import java.awt.Font;
import javax.swing.ImageIcon;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.text.DateFormat;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
public class TelaPrincipal extends JFrame {

	private JPanel Menu;
	
	 Connection conexao = null;
	 PreparedStatement pst = null;
	 ResultSet rs = null;
	 Appconn appconn = new Appconn();
	
	public static void main(String[] args) {
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					TelaPrincipal frame = new TelaPrincipal();
					frame.setVisible(true);
					
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
	}
	public void getDesktop() {
		   return desktop;
	   }
	
	
	public TelaPrincipal() {
		
		
		JMenuItem mntSair = new JMenuItem("Sair");
		mntSair.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				
				int sair = JOptionPane.showConfirmDialog(null, "Tem certeza que deseja sair?", "Atenção",JOptionPane.YES_NO_OPTION);
				if(sair == JOptionPane.YES_OPTION) {
					System.exit(0);
				}	
			}
		});
		
		
		
		addWindowListener(new WindowAdapter() {
			public void windowActivated(WindowEvent e) {
				
				
				    Date data = new Date();
			        DateFormat formatador = DateFormat.getDateInstance(DateFormat.SHORT);
			        lblData.setText(formatador.format(data));  //lblData também sublinhado em vermelho não reconhece
			        
			}
		});
		 setResizable(false);
		setTitle("X - Sistema para controle de OS");
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setBounds(100, 100, 880, 558);
		
		JMenuBar menuBar = new JMenuBar();
		setJMenuBar(menuBar);
		
		JMenu mnCadastro = new JMenu("Cadastro");
		menuBar.add(mnCadastro);
		
		JMenuItem mntClientes = new JMenuItem("Clientes");
		mnCadastro.add(mntClientes);
		
		JMenuItem mntOS = new JMenuItem("OS");
		mnCadastro.add(mntOS);
		
		JMenuItem mntUsuario = new JMenuItem("Usuario");
		mntUsuario.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				
				TelaUsuario usuario = new TelaUsuario();
				
				desktop.add(usuario); // fica em sublinhado em vermelho desktop não reconhece
				usuario.setClosable(true);
				usuario.setIconifiable(true);
				usuario.setMaximizable(true);
				usuario.setVisible(true);
					
			}
		});
		mnCadastro.add(mntUsuario);
		
		JMenu mnRelatorio = new JMenu("Relatorio");
		menuBar.add(mnRelatorio);
		
		JMenuItem mntServicos = new JMenuItem("Servicos");
		mnRelatorio.add(mntServicos);
		
		JMenu mnAjuda = new JMenu("Ajuda");
		menuBar.add(mnAjuda);
		
		JMenuItem mntSobre = new JMenuItem("Sobre");
		mnAjuda.add(mntSobre);
		
		JMenu mnOpcoes = new JMenu("Opcoes");
		menuBar.add(mnOpcoes);
		
		mnOpcoes.add(mntSair);
		Menu = new JPanel();
		Menu.setBorder(new EmptyBorder(5, 5, 5, 5));
		setContentPane(Menu);
		Menu.setLayout(null);
		
		
		JLabel lblUsuario = new JLabel("Usuario");
		lblUsuario.setFont(new Font("Tahoma", Font.PLAIN, 26));
		lblUsuario.setBounds(722, 54, 107, 49);
		Menu.add(lblUsuario);
		
		
		
		JLabel lblNewLabel = new JLabel("");
		lblNewLabel.setIcon(new ImageIcon(TelaPrincipal.class.getResource("/br/com/infox/icones/x1.png")));
		lblNewLabel.setBounds(708, 209, 127, 136);
		Menu.add(lblNewLabel);
		
		
		
		
		final JDesktopPane desktop = new JDesktopPane();
		desktop.setBounds(20, 23, 661, 463);
		Menu.add(desktop);
		
		final JLabel lblData = new JLabel("Data");
		lblData.setFont(new Font("Dialog", Font.PLAIN, 20));
		lblData.setBounds(708, 131, 120, 26);
		Menu.add(lblData);
		
		 
		
	}
}

Parece que vc declarou o desktop dentro do construtor apenas, com isso, ele não será visível fora dele.

Mova essa linha:

final JDesktopPane desktop = new JDesktopPane();

para fora do construtor da classe.

funcionou!! puts grila valeu mesmo.

Bacana!

Mas só pra tu entender: Se o código estiver correto, poderia está sendo feito no notepad, que iria funcionar do mesmo jeito. Não é problema pelo fato de estar sendo usado netbeans ou eclipse.

É, o fato de rodar no elipse depois de ter feito em netbeans na verdade me da uma boa base sobre o mesmo código.

Muito obrigado