bom pessoal desculpa tah pedindo isso mas eu sou tenho aula quinta feira com o prof desta matéria e estava qrendo ver o erros do programa que alias
foi ele quem passou escrito na lousa…
escrevi tudo igual mas sempre em programas um pouco mais elaborados agente acaba sempre eskecendo algo…
se tiver como alguem ajudar vlw
package exercicios;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class NovosComponentes extends JFrame {
implement ActionListener{
private JTextField tf1, tf2;
private JComboBox cbOp;
private JButton bCalc;
private JTextArea taRes;
public static void main(String d[]){
new.NovosComponentes().setVisible(true);
}
public NovosComponentes(){
super("Calculadora");// o mesmo que setTitle("claculadora");
Container op = getContentPane();
JPanel p = new JPanel();
p.add(tf1 = new JTextField(5));
p.add(cbOp = new JComboBox());
p.add(tf2 = new JTextField(5));
p.add(bCalc = new JButton("="));
op.add("North",p);// Adiciona o conteudo na parte norte da janela
taRes = new JTextArea();
JScrollPane sp = new JScrollPane(taRes);
op.add("Center",sp);
taRes.setEditable(false);
cbOp.add("+");
cbOp.add("-");
pack();
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
bCalc.addActionListener(this);
}
public void actionPerfomerd( ActionEvent evt){
try{
double v1 = Double.parseDouble(tf1.getText());
double v2 = Double.parseDouble(tf2.getText());
double r=0;
switch(cbOp.getSelectedIndex()){
case 0 :
r = v1+v2;
break;
case 1 :
r = v1 - v2;
break;
}
tf1.setText("");
tf2.setText("");
taRes.append(">"+v1+cbOp.getSelectedItem()+v2+" = "+r+"\n");
}
catch(Exception exc){
taRes.append("Valor(es) Inválido(s)!!!");
}
}
}
}
Não sei se ajuda mas estes são os erros que dão…
Syntax error on token “}”, delete this token NovosComponentes.java GUI/src/exercicios line 70 Java Problem
Syntax error on token “implements”, @ expected NovosComponentes.java GUI/src/exercicios line 8 Java Problem
Syntax error on token “new”, invalid Expression NovosComponentes.java GUI/src/exercicios line 16 Java Problem
Syntax error, insert “}” to complete Block NovosComponentes.java GUI/src/exercicios line 8 Java Problem
The method add(String, Component) in the type Container is not applicable for the arguments (String) NovosComponentes.java GUI/src/exercicios line 35 Java Problem
The method add(String, Component) in the type Container is not applicable for the arguments (String) NovosComponentes.java GUI/src/exercicios line 36 Java Problem
The method addActionListener(ActionListener) in the type AbstractButton is not applicable for the arguments (NovosComponentes) NovosComponentes.java GUI/src/exercicios line 41 Java Problem
The serializable class NovosComponentes does not declare a static final serialVersionUID field of type long NovosComponentes.java GUI/src/exercicios line 7 Java Problem
