JDesktopPane

olá galera alguém pode me infomar pq esta dando esse erro.[/code]/*

  • NovoJFrame.java
  • Created on 31 de Julho de 2007, 16:20
    */

package javaapplication4;

/**
*

  • @author Benfino
    */
    public class NovoJFrame extends javax.swing.JFrame {

    /** Creates new form NovoJFrame */
    public NovoJFrame() {
    initComponents();
    desktop = new JDesktopPane();
    getContentPane().add(desktop);
    }

    /** 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.
      */
      //
      private void initComponents() {
      jDesktopPane1 = new javax.swing.JDesktopPane();

      setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
      jDesktopPane1.setBackground(new java.awt.Color(255, 255, 255));

      javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
      getContentPane().setLayout(layout);
      layout.setHorizontalGroup(
      layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
      .addComponent(jDesktopPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 400, Short.MAX_VALUE)
      );
      layout.setVerticalGroup(
      layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
      .addComponent(jDesktopPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 300, Short.MAX_VALUE)
      );
      pack();
      }//

    /**

    • @param args the command line arguments
      */
      public static void main(String args[]) {
      java.awt.EventQueue.invokeLater(new Runnable() {
      public void run() {
      new NovoJFrame().setVisible(true);
      // getContentPane().add(desktop);
      }
      });
      }

    // Declaração de variáveis - não modifique
    private javax.swing.JDesktopPane jDesktopPane1;
    // Fim da declaração de variáveis

}[code]

tem vários erros…

1º - vc não está fazendo o import do JDesktopPane
2º - a variável / atributo “desktop” não foi declarada em lugar nenhum.
3º - javax.swing.GroupLayout não existe (a não ser que vc use uma versão que exista, eu utilizo a versão 5.0 e não tem esse gerenciador de layout)

GroupLayout foi adicionado ao java a partir da versão 1.6
antes disso você tem que utilizar o jar que o netbeans faz esse GroupLayout

eu copiei o comando dele pro meu pc e ele so achou os 2 primeiros erros
ele encontrou o javax.swing.GroupLayout

vc tem qui usar o
import javax.swing.JDesktopPane
e define o desktop

JDesktopPane desktop = new JDesktopPane(); getContentPane().add(desktop);

Valeu velhu brigadaum cara agora deu certo.