ola gente bom dia a todos!!
Gente Gostaria de saber se tem algum tutorial basico para o netBeans baixei junto com sdk 5.0.
além deste tenho outro problema no meu codigo la vai:
import java.awt.;
import java.awt.event.;
import javax.swing.;
import java.Swing.event.;
import java.util.*;
public class ProvaFinal extends WindowAdapter implements ActionListener{
public static void main(String[] args){//
Frame f=new Frame("Calculadora");//
f.setSize(200,200);//
f.setBackground(Color.gray);//
f.setLayout(new FlowLayout(FlowLayout.LEFT));//
Label label1 = new Label("Valor");//
Label label2 = new Label("Resultado");//
f.add(label1);//
f.add(label2);//
TextField t1=new TextField(10);//
TextField t2= new TextField(10);//
f.add(t1); //
f.add (t2);//
Button b1= new Button("ok");//
Button b2= new Button ("limpar");//
f.add(b1);//
f.add(b2);//
f.addWindowListener(new ProvaFinal ());//
f.setVisible(true);//
}
public void WindowClosing(WindowEvent e){
System.exit(0);//
}
}
:arrow: JTextField Resultado = new JTextField(10);//
:arrow: JButton b2 = new JButton ("Limpar");//
:arrow: b2.addActionListener(this);//
:arrow: public void actionPerformed (ActionEvent e){//
if(e.getSource()== b2){ //
Resultado.setText(""); //
}
}
if(e.getSource()==b1){ //
Resultado.setText(“OK”);
}
if( e.get source()==b2){//
valor.setText("limpar");}
onde está marcado esta erro de compilação classe ou interface esperado
alguns amigos do portal deram dicas boas das quais pela situação so um deu certo e agora gente me dêem uma luz neste tunel por favor!!
karlota
tudo que esta abaixo da 1º marcação esta fora do escopo da classe ! confere suas { ok ?
ve se funciona …
foi mal , esqueci do codigo …
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.Swing.event.*;
import java.util.*;
public class ProvaFinal extends WindowAdapter implements ActionListener{
public static void main(String[] args){//
Frame f=new Frame("Calculadora");//
f.setSize(200,200);//
f.setBackground(Color.gray);//
f.setLayout(new FlowLayout(FlowLayout.LEFT));//
Label label1 = new Label("Valor");//
Label label2 = new Label("Resultado");//
f.add(label1);//
f.add(label2);//
TextField t1=new TextField(10);//
TextField t2= new TextField(10);//
f.add(t1); //
f.add (t2);//
Button b1= new Button("ok");//
Button b2= new Button ("limpar");//
f.add(b1);//
f.add(b2);//
f.addWindowListener(new ProvaFinal ());//
f.setVisible(true);//
}
public void WindowClosing(WindowEvent e){
System.exit(0);//
JTextField Resultado = new JTextField(10);//
JButton b2 = new JButton ("Limpar");//
b2.addActionListener(this);//
}
public void actionPerformed (ActionEvent e){//
if (e.getSource() == b2) { //
Resultado.setText(""); //
}
if (e.getSource() == b1) { //
Resultado.setText("OK");
}
if (e.getSource() == b2) { //
valor.setText("limpar");
}
}
}