Galera preciso que o botao limpar funcione nesta classe ,,brigadao

import java.awt.event.ActionEvent;

public class CADASTROINSTALACAO extends javax.swing.JFrame {

/** Creates new form CADASTROINSTALACAO */
public CADASTROINSTALACAO() {
    initComponents();
}


// <editor-fold defaultstate="collapsed" desc=" Código Gerado ">                          
private void initComponents() {
    TITULO = new javax.swing.JLabel();
    cod = new javax.swing.JLabel();
    unidade = new javax.swing.JLabel();
    nome = new javax.swing.JLabel();
    data = new javax.swing.JLabel();
    codservico = new javax.swing.JLabel();
    valor = new javax.swing.JLabel();
    obs = new javax.swing.JLabel();
    codigo = new javax.swing.JTextField();
    unidades = new javax.swing.JTextField();
    nomes = new javax.swing.JTextField();
    datas = new javax.swing.JTextField();
    codservicos = new javax.swing.JTextField();
    valores = new javax.swing.JTextField();
    jScrollPane1 = new javax.swing.JScrollPane();
    obss = new javax.swing.JTextArea();
    cadastro = new javax.swing.JButton();
    limpar = new javax.swing.JButton();

    setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
    TITULO.setFont(new java.awt.Font("Arial", 1, 12));
    TITULO.setText("CADASTRO INSTALA\u00c7\u00c3O");

    cod.setFont(new java.awt.Font("Tahoma", 1, 11));
    cod.setText("Cod:");

    unidade.setFont(new java.awt.Font("Tahoma", 1, 11));
    unidade.setText("Unidade:");

    nome.setFont(new java.awt.Font("Tahoma", 1, 11));
    nome.setText("Nome:");

    data.setFont(new java.awt.Font("Tahoma", 1, 11));
    data.setText("Data:");

    codservico.setFont(new java.awt.Font("Tahoma", 1, 11));
    codservico.setText("Cod Servi\u00e7o:");

    valor.setFont(new java.awt.Font("Tahoma", 1, 11));
    valor.setText("Valor:");

    obs.setFont(new java.awt.Font("Tahoma", 1, 11));
    obs.setText("Obs:");

    obss.setColumns(20);
    obss.setRows(5);
    jScrollPane1.setViewportView(obss);

    cadastro.setFont(new java.awt.Font("Tahoma", 1, 11));
    cadastro.setText("CADASTRO");
    cadastro.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            cadastroActionPerformed(evt);
        }
    });

    limpar.setFont(new java.awt.Font("Tahoma", 1, 11));
    limpar.setText("LIMPAR");
    limpar.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            limparActionPerformed(evt);
        }
    });

    org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane());
    getContentPane().setLayout(layout);
    layout.setHorizontalGroup(
        layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
        .add(layout.createSequentialGroup()
            .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                .add(layout.createSequentialGroup()
                    .add(102, 102, 102)
                    .add(TITULO))
                .add(layout.createSequentialGroup()
                    .addContainerGap()
                    .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                        .add(obs)
                        .add(cadastro)
                        .add(layout.createSequentialGroup()
                            .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                                .add(valor)
                                .add(nome)
                                .add(data)
                                .add(cod)
                                .add(unidade)
                                .add(codservico))
                            .add(8, 8, 8)
                            .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                                .add(jScrollPane1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 192, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING, false)
                                    .add(org.jdesktop.layout.GroupLayout.LEADING, unidades)
                                    .add(org.jdesktop.layout.GroupLayout.LEADING, codigo, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 34, Short.MAX_VALUE))
                                .add(codservicos, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 39, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING, false)
                                    .add(org.jdesktop.layout.GroupLayout.LEADING, valores)
                                    .add(org.jdesktop.layout.GroupLayout.LEADING, datas, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 86, Short.MAX_VALUE))
                                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
                                    .add(limpar, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 94, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                                    .add(nomes, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 249, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)))))))
            .addContainerGap())
    );
    layout.setVerticalGroup(
        layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
        .add(layout.createSequentialGroup()
            .addContainerGap()
            .add(TITULO)
            .add(19, 19, 19)
            .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                .add(cod)
                .add(codigo, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
            .add(17, 17, 17)
            .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                .add(unidade)
                .add(unidades, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
            .add(20, 20, 20)
            .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                .add(nome)
                .add(nomes, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
            .add(24, 24, 24)
            .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                .add(data)
                .add(datas, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
            .add(23, 23, 23)
            .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                .add(codservico)
                .add(codservicos, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
            .add(25, 25, 25)
            .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                .add(valor)
                .add(valores, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
            .add(26, 26, 26)
            .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                .add(obs)
                .add(jScrollPane1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
            .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 17, Short.MAX_VALUE)
            .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                .add(cadastro)
                .add(limpar))
            .addContainerGap())
    );
    pack();
}// </editor-fold>                        

private void limparActionPerformed(java.awt.event.ActionEvent evt) {                                       
     
    if(evt.getActionCommand().equals("limpar")){
        unidades.setText("");
        nomes.setText("");
        datas.setText("");
        valores.setText("");
        obss.setText("");
    }

            
}                                      

private void cadastroActionPerformed(java.awt.event.ActionEvent evt) {                                         
     String  x = codigo.getText();
     int     a = Integer.parseInt(x);
     String  b = unidades.getText();
     String  c = datas.getText();
     String  d = codservicos.getText();
     String  e = valores.getText();
     String  f = obss.getText();
     InserirInstalacao to = new InserirInstalacao(a,b,c,d,e,f);

      
        

}                                        

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

// Declaração de variáveis - não modifique                     
private javax.swing.JLabel TITULO;
private javax.swing.JButton cadastro;
private javax.swing.JLabel cod;
private javax.swing.JTextField codigo;
private javax.swing.JLabel codservico;
private javax.swing.JTextField codservicos;
private javax.swing.JLabel data;
private javax.swing.JTextField datas;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JButton limpar;
private javax.swing.JLabel nome;
private javax.swing.JTextField nomes;
private javax.swing.JLabel obs;
private javax.swing.JTextArea obss;
private javax.swing.JLabel unidade;
private javax.swing.JTextField unidades;
private javax.swing.JLabel valor;
private javax.swing.JTextField valores;
// Fim da declaração de variáveis                   
               
    }

Quer um cafezinho e uma massagem nas costas também? :evil:

ahuahau FFelix pelo menos identa isso cara, dessa maneira ninguem vai querer te ajudar.

Olha so seu codigo esta meio ruim de ler aqui no browser
caso vc adiciona seus objetos em Jpanel

faça um for varrendo os objetos dentro dele e seta
setText("")
caso instancia JTextField

valeu

Vc esta usando o netbeans ne?

seguinte, aqui nessa linha vc faz a ação

[code] private void limparActionPerformed(java.awt.event.ActionEvent evt) {

if(evt.getActionCommand().equals(“limpar”)){
unidades.setText("");
nomes.setText("");
datas.setText("");
valores.setText("");
obss.setText("");
}

}[/code]

em if(evt.getActionCommand().equals("limpar")){ qual a utilidade disso para você no código? Pelo que percebi, vc nao precisa disso, ja que o seu action esta associado ao botão. em cadastro.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { cadastroActionPerformed(evt); } });

Retira esse if, e tenta.

Espero nao estar falando merda, mas foi isso q percebi…

e se você você quiser limpar todos os TextFields e ta com preguiça de colocar cada um deles pode fazer isso

public void clear(){ Component[] components = this.getContentPane().getComponents(); for(Component x : components){ if(x instanceof JTextField) ((JTextField)x).setText(""); } }
^^