Comunidad de diseño web y desarrollo en internet online

<identifier> expected Ayuda porfabor

Citar            
MensajeEscrito el 16 Ene 2009 03:26 am
hola soy un practicante de java sigo siendo novato ciertamente pero ya tengo algunas nociones pero como deje de practicar he olvidado un poco y en verdad nesesito ayuda con este codigo el error es el clasico <identifier> expected aqui les dejo el codigo para ver si alguien me puede ayudar se los agradeceria mucho y si pueden porfabor me mandan un correo a la cuenta de [email protected] aparte de postearlo para que los de mas aprendan (ya que esa es la funcion del foro no :D ) gracias de antemano(por cierto podria ser que les marque error por que falta la base de datos pero espero que no sea nesesaria para identificar el error:

import java.io.*;
import java.io.File;
import java.awt.*;
import java.awt.MenuBar;
import javax.swing.*;
import java.lang.String;
import java.awt.event.*;
import java.applet.Applet;
import java.awt.TextField;
import java.sql.*;

public class hinter1 extends JFrame implements ActionListener {
String 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46;
Connection Conexion;
ResultSet Resultado;
Statement Sentencia;
ImageIcon ima2 = new ImageIcon("dragon.png");
Container c;
TextArea taAta =new TextArea("");
TextArea taVic =new TextArea("");
JTextField tfNom = new JTextField(30);
JTextField tfNiv = new JTextField(30);
JTextField tfExp = new JTextField(30);
JTextField tfAps = new JTextField(30);
JTextField tfJp = new JTextField(30);
JTextField tfHp = new JTextField(30);
JTextField tfMp = new JTextField(30);
JTextField tfCt = new JTextField(30);
JTextField tfFue = new JTextField(30);
JTextField tfDes = new JTextField(30);
JTextField tfRes = new JTextField(30);
JTextField tfAgi = new JTextField(30);
JTextField tfSab = new JTextField(30);
JTextField tfInt = new JTextField(30);
JTextField tfVit = new JTextField(30);
JTextField tfBrv = new JTextField(30);
JTextField tfFe = new JTextField(30);
JTextField tfAgu = new JTextField(30);
JTextField tfFueg = new JTextField(30);
JTextField tfTie = new JTextField(30);
JTextField tfAir = new JTextField(30);
JTextField tfTru = new JTextField(30);
JTextField tfHie = new JTextField(30);
JTextField tfBio = new JTextField(30);
JTextField tfPsi = new JTextField(30);
JTextField tfObs = new JTextField(30);
JTextField tfSag = new JTextField(30);
JTextField tfCasco = new JTextField(30);
JTextField tfPeto = new JTextField(30);
JTextField tfBrazeras = new JTextField(30);
JTextField tfMI = new JTextField(30);
JTextField tfMD = new JTextField(30);
JTextField tfPanto = new JTextField(30);
JTextField tfBotas = new JTextField(30);
JTextField tfAcc1 = new JTextField(30);
JTextField tfAcc2 = new JTextField(30);
JTextField tfAcc3 = new JTextField(30);
JTextField tfRobado = new JTextField(30);
JTextField tfIr = new JTextField(30);
JLabel eNom = new JLabel("Nombre:");
JLabel eNiv = new JLabel("Nivel:");
JLabel eExp = new JLabel("Exp:");
JLabel eAps = new JLabel("AP´s:");
JLabel eJp = new JLabel("Job:");
JLabel eHp = new JLabel("Hp:");
JLabel eMp = new JLabel("Mp:");
JLabel eCt = new JLabel("CT:");
JLabel eFue = new JLabel("Fue:");
JLabel eDes = new JLabel("Des:");
JLabel eRes = new JLabel("Res:");
JLabel eAgi = new JLabel("Agi:");
JLabel eSab = new JLabel("Sab:");
JLabel eInt = new JLabel("Int:");
JLabel eVit = new JLabel("Vit:");
JLabel eBrv = new JLabel("Brv:");
JLabel eFe = new JLabel("Fé:");
JLabel eAgu = new JLabel("Agua:");
JLabel eFueg = new JLabel("Fuego:");
JLabel eTie = new JLabel("Tierra:");
JLabel eAir = new JLabel("Aire:");
JLabel eTru = new JLabel("Trueno:");
JLabel eHie = new JLabel("Hielo:");
JLabel eBio = new JLabel("Bio:");
JLabel ePsi = new JLabel("Psiquico:");
JLabel eObs = new JLabel("Obscuro:");
JLabel eSag = new JLabel("Sagrado:");
JLabel eAtaques = new JLabel("Ataques:");
JLabel eCasco = new JLabel("Casco:");
JLabel ePeto = new JLabel("Peto:");
JLabel eBrazeras = new JLabel("Brazeras:");
JLabel eMI = new JLabel("M. Izquierda:");
JLabel eMD = new JLabel("M. Derecha:");
JLabel ePanto = new JLabel("Panto:");
JLabel eBotas = new JLabel("Botas:");
JLabel eAcc1 = new JLabel("Acc1:");
JLabel eAcc2 = new JLabel("Acc2:");
JLabel eAcc3 = new JLabel("Acc3:");
JLabel eTes = new JLabel("Tesoro:");
JLabel eVic = new JLabel("Por Victoria:");
JLabel eRobado = new JLabel("Robado:");
JLabel eIr = new JLabel("Item Raro:");
JButton bGua = new JButton("Guardar");

public hinter1() {
super("Hunter of Treasures");
setIconImage(ima2.getImage());
this.setBounds(100,100,640,520);
this.getContentPane().setLayout(null);
this.getContentPane().add(eNom);
eNom.setBounds(20,20,80,20);
this.getContentPane().add(eNiv);
eNiv.setBounds(60,60,80,20);
this.getContentPane().add(eExp);
eExp.setBounds(160,60,50,20);
this.getContentPane().add(eAps);
eAps.setBounds(250,60,50,20);
this.getContentPane().add(eJp);
eJp.setBounds(340,60,50,20);
this.getContentPane().add(eHp);
eHp.setBounds(96,100,50,20);
this.getContentPane().add(eMp);
eMp.setBounds(213,100,50,20);
this.getContentPane().add(eCt);
eCt.setBounds(329,100,50,20);
this.getContentPane().add(eFue);
eFue.setBounds(20,140,40,20);
this.getContentPane().add(eDes);
eDes.setBounds(20,160,40,20);
this.getContentPane().add(eRes);
eRes.setBounds(20,180,40,20);
this.getContentPane().add(eAgi);
eAgi.setBounds(20,200,40,20);
this.getContentPane().add(eSab);
eSab.setBounds(20,220,40,20);
this.getContentPane().add(eInt);
eInt.setBounds(20,240,40,20);
this.getContentPane().add(eVit);
eVit.setBounds(20,260,40,20);
this.getContentPane().add(eBrv);
eBrv.setBounds(20,280,40,20);
this.getContentPane().add(eFe);
eFe.setBounds(20,300,40,20);
this.getContentPane().add(eAgu);
eAgu.setBounds(100,140,40,20);
this.getContentPane().add(eFueg);
eFueg.setBounds(100,160,40,20);
this.getContentPane().add(eTie);
eTie.setBounds(100,180,40,20);
this.getContentPane().add(eAir);
eAir.setBounds(100,200,40,20);
this.getContentPane().add(eTru);
eTru.setBounds(100,220,60,20);
this.getContentPane().add(eHie);
eHie.setBounds(100,240,40,20);
this.getContentPane().add(eBio);
eBio.setBounds(100,260,40,20);
this.getContentPane().add(ePsi);
ePsi.setBounds(100,280,60,20);
this.getContentPane().add(eObs);
eObs.setBounds(100,300,60,20);
this.getContentPane().add(eSag);
eSag.setBounds(100,320,60,20);
this.getContentPane().add(eAtaques);
eAtaques.setBounds(220,140,80,20);
this.getContentPane().add(eCasco);
eCasco.setBounds(370,140,80,20);
this.getContentPane().add(ePeto);
ePeto.setBounds(370,160,80,20);
this.getContentPane().add(eBrazeras);
eBrazeras.setBounds(370,180,80,20);
this.getContentPane().add(eMI);
eMI.setBounds(370,200,80,20);
this.getContentPane().add(eMD);
eMD.setBounds(370,220,80,20);
this.getContentPane().add(ePanto);
ePanto.setBounds(370,240,80,20);
this.getContentPane().add(eBotas);
eBotas.setBounds(370,260,80,20);
this.getContentPane().add(eAcc1);
eAcc1.setBounds(370,280,80,20);
this.getContentPane().add(eAcc2);
eAcc2.setBounds(370,300,80,20);
this.getContentPane().add(eAcc3);
eAcc3.setBounds(370,320,80,20);
this.getContentPane().add(eTes);
eTes.setBounds(20,340,60,20);
this.getContentPane().add(eRobado);
eRobado.setBounds(20,360,60,20);
this.getContentPane().add(eIr);
eIr.setBounds(20,400,60,20);
this.getContentPane().add(eVic);
eVic.setBounds(200,360,80,20);
this.getContentPane().add(tfNom);
tfNom.setBounds(80,20,200,20);
this.getContentPane().add(tfNiv);
tfNiv.setBounds(90,60,40,20);
this.getContentPane().add(tfExp);
tfExp.setBounds(185,60,40,20);
this.getContentPane().add(tfAps);
tfAps.setBounds(280,60,40,20);
this.getContentPane().add(tfJp);
tfJp.setBounds(365,60,40,20);
this.getContentPane().add(tfHp);
tfHp.setBounds(116,100,40,20);
this.getContentPane().add(tfMp);
tfMp.setBounds(233,100,40,20);
this.getContentPane().add(tfCt);
tfCt.setBounds(349,100,40,20);
this.getContentPane().add(tfFue);
tfFue.setBounds(50,141,40,18);
this.getContentPane().add(tfDes);
tfDes.setBounds(50,161,40,18);
this.getContentPane().add(tfRes);
tfRes.setBounds(50,181,40,18);
this.getContentPane().add(tfAgi);
tfAgi.setBounds(50,201,40,18);
this.getContentPane().add(tfSab);
tfSab.setBounds(50,221,40,18);
this.getContentPane().add(tfInt);
tfInt.setBounds(50,241,40,18);
this.getContentPane().add(tfVit);
tfVit.setBounds(50,261,40,18);
this.getContentPane().add(tfBrv);
tfBrv.setBounds(50,281,40,18);
this.getContentPane().add(tfFe);
tfFe.setBounds(50,301,40,18);
this.getContentPane().add(tfAgu);
tfAgu.setBounds(160,141,40,18);
this.getContentPane().add(tfFueg);
tfFueg.setBounds(160,161,40,18);
this.getContentPane().add(tfTie);
tfTie.setBounds(160,181,40,18);
this.getContentPane().add(tfAir);
tfAir.setBounds(160,201,40,18);
this.getContentPane().add(tfTru);
tfTru.setBounds(160,221,40,18);
this.getContentPane().add(tfHie);
tfHie.setBounds(160,241,40,18);
this.getContentPane().add(tfBio);
tfBio.setBounds(160,261,40,18);
this.getContentPane().add(tfPsi);
tfPsi.setBounds(160,281,40,18);
this.getContentPane().add(tfObs);
tfObs.setBounds(160,301,40,18);
this.getContentPane().add(tfSag);
tfSag.setBounds(160,321,40,18);
this.getContentPane().add(tfCasco);
tfCasco.setBounds(450,140,150,20);
this.getContentPane().add(tfPeto);
tfPeto.setBounds(450,160,150,20);
this.getContentPane().add(tfBrazeras);
tfBrazeras.setBounds(450,180,150,20);
this.getContentPane().add(tfMI);
tfMI.setBounds(450,200,150,20);
this.getContentPane().add(tfMD);
tfMD.setBounds(450,220,150,20);
this.getContentPane().add(tfPanto);
tfPanto.setBounds(450,240,150,20);
this.getContentPane().add(tfBotas);
tfBotas.setBounds(450,260,150,20);
this.getContentPane().add(tfAcc1);
tfAcc1.setBounds(450,280,150,20);
this.getContentPane().add(tfAcc2);
tfAcc2.setBounds(450,300,150,20);
this.getContentPane().add(tfAcc3);
tfAcc3.setBounds(450,320,150,20);
this.getContentPane().add(tfRobado);
tfRobado.setBounds(80,360,115,20);
this.getContentPane().add(tfIr);
tfIr.setBounds(80,400,115,20);
this.getContentPane().add(taVic);
taVic.setBounds(280,360,320,60);
this.getContentPane().add(taAta);
taAta.setBounds(220,160,130,180);
this.getContentPane().add(bGua);
bGua.setBounds(520,440,80,20);
bGua.addActionListener(this);
this.setVisible(true);
}

public void guardar (String a1,String a2,String a3,String a4,String a5,String a6,String a7,String a8,String a9,String a10,String a11,String a12,String a13,String a14,String a15,String a16,String a17,String a18,String a19,String a20,String a21,String a22,String a23,String a24,String a25,String a26,String a27,String a28,String a29,String a30,String a31,String a32,String a33,String a34,String a35,String a36,String a37,String a38,String a39,String a40,String a41,String a42,String a43,String a44,String a45,String a46){
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Conexion=DriverManager.getConnection("jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)};DBQ= Hunter.mdb");
Sentencia=Conexion.createStatement();
Sentencia.execute("Insert into moustros values('"+a1+"','"+a2+"','"+a3+"','"+a4+"','"+a5+"','"+a6+"','"+a7+"','"+a8+"','"+a9+"','"+a10+"','"+a11+"','"+a12+"','"+a13+"','"+a14+"','"+a15+"','"+a16+"','"+a17+"','"+a18+"','"+a19+"','"+a20+"','"+a21+"','"+a22+"','"+a23+"','"+a24+"','"+a25+"','"+a26+"','"+a27+"','"+a28+"','"+a29+"','"+a30+"','"+a31+"','"+a32+"','"+a33+"','"+a34+"','"+a35+"','"+a36+"','"+a37+"','"+a38+"','"+a39+"','"+a40+"','"+a41+"','"+a42+"','"+a43+"','"+a44+"','"+a45+"','"+a46+"')");
Sentencia.close();
Conexion.close();
}catch(ClassNotFoundException cnfe){}
catch (SQLException e){
System.out.println("Estado "+e.getSQLState());
System.out.println("Codigo de error"+e.getErrorCode());
e.printStackTrace();
}
}


public static void main(String arg[]){
hinter1 hun1=new hinter1();
hun1.addWindowListener(new WindowAdapter(){
public void windowClosing(WindowEvent e){
System.exit(0);
}
});
}
public void actionPerformed(ActionEvent e){
String o=e.getActionCommand();
if(o.equals("Guardar")){
1=tfNom.getText();
2=tfNiv.getText();
3=tfExp.getText();
4=tfAps.getText();
5=tfJp.getText();
6=tfHp.getText();
7=tfMp.getText();
8=tfCt.getText();
9=tfFue.getText();
10=tfDes.getText();
11=tfRes.getText();
12=tfAgi.getText();
13=tfSab.getText();
14=tfInt.getText();
15=tfVit.getText();
16=tfBrv.getText();
17=tfFe.getText();
18=tfAgu.getText();
19=tfFueg.getText();
20=tfTie.getText();
21=tfAir.getText();
22=tfTru.getText();
23=tfHie.getText();
24=tfBio.getText();
25=tfPsi.getText();
26=tfObs.getText();
27=tfSag.getText();
28=tfCasco.getText();
29=tfPeto.getText();
30=tfBrazeras.getText();
31=tfMI.getText();
32=tfMD.getText();
33=tfPanto.getText();
34=tfBotas.getText();
35=tfAcc1.getText();
36=tfAcc2.getText();
37=tfAcc3.getText();
38=tfRobado.getText();
39=tfIr.getText();
40=taAta.getText();
41=taVic.getText();
guardar(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46);
}
}
}

Por yopo

3 de clabLevel



 

msie7
Citar            
MensajeEscrito el 16 Ene 2009 08:05 pm
:S Java <> Javascript aparte esta como empanadoso ese codigo..

Por bipsa

628 de clabLevel

1 tutorial
1 articulo

Genero:Masculino  

Colombia

safari

 

Cristalab BabyBlue v4 + V4 © 2011 Cristalab
Powered by ClabEngines v4, HTML5, love and ponies.