Gostaria de saber onde estou errando pois compilei meu programa e ele esta dando erro.
Exception in thread “main” java.lang.NoClassDefFoundError: Escrever.
Será que a classe que extendi é erada?
import java.awt.<em>;
import java.awt.event.</em>;
import javax.swing.*;
public class Escrever extends JPanel {
public static void main(String[] args) {
JFrame f = new JFrame("Escrever");
f.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent we) { System.exit(0); }
});
f.setSize(200,200);
f.setLocation(200,200);
f.setVisible(true);
final JTextField field = new JTextField();
final JTextField field1 = new JTextField();
final JTextField field2 = new JTextField();
JLabel label1 = new JLabel(“Nome”);
JLabel label2 = new JLabel(“End”);
JLabel label3 = new JLabel(“e-mail”);
Container content = f.getContentPane();
content.setLayout(new GridLayout(3,3));
content.add(label1);
content.add(label2);
content.add(label3);
content.add(field);
content.add(field1);
content.add(field2);
JButton button = new JButton(“Escrever”);
JPanel painel = new JPanel();
painel.add(button);
button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
System.out.println(field.getText() + ’
');
System.out.println(field1.getText() + ’
');
System.out.println(field2.getText() + ’
');
}
});
}
}
utilizo o sdk1.3.1_03
obrigado.