Erro

5 respostas
D

Pessoal, o que eu faço quando dá esse erro, nunca vi isso antes
Note: C:\eclipse 3.0M7\workspace\Programa\Login.java uses or overrides a deprecated API.
Note: Recompile with -deprecation for details.

Por favor me ajudem.

5 Respostas

E

eae blz?

pareceme que não conseguiu achar algum arquivo jar
necessario para compilar a sua classe

tanto:

está pedindo para vc recompilar detalhando oq vc vai usar

qq coisa manda o seu codigo ai, ou todo log de erro :wink:

[]'s
Erko Bridee

D
import java.awt.event.ActionEvent;

import java.awt.event.ActionListener;

import java.sql.ResultSet;

import java.sql.SQLException;

import javax.swing.JInternalFrame;

import javax.swing.JOptionPane;

/*

  • Created on 14/09/2004

  • To change the template for this generated file go to

  • Window - Preferences - Java - Code Generation - Code and Comments
    /
    /
    *

  • @author seiti

  • To change the template for this generated type comment go to

  • Window - Preferences - Java - Code Generation - Code and Comments
    
    */
    
    public class Login extends JInternalFrame implements ActionListener {
    
    private javax.swing.JPanel jContentPane = null;
    
    private javax.swing.JLabel jLabel = null;
    
    private javax.swing.JLabel jLabel1 = null;
    
    private javax.swing.JTextField jTextField = null;
    
    private javax.swing.JLabel jLabel2 = null;
    
    private javax.swing.JPasswordField jPasswordField = null;
    
    private javax.swing.JButton jButton = null;
    
    private javax.swing.JButton jButton1 = null;
    
    /**
    
    */
    
    public Login() {
    
    super();
    
    // TODO Auto-generated constructor stub
    
    initialize();
    
    }
    

    /**

    • @param arg0
      */
      public Login(String arg0) {
      super(arg0);
      // TODO Auto-generated constructor stub
      initialize();
      }

    /**

    • @param arg0
    • @param arg1
      */
      public Login(String arg0, boolean arg1) {
      super(arg0, arg1);
      // TODO Auto-generated constructor stub
      initialize();
      }

    /**

    • @param arg0
    • @param arg1
    • @param arg2
      */
      public Login(String arg0, boolean arg1, boolean arg2) {
      super(arg0, arg1, arg2);
      // TODO Auto-generated constructor stub
      initialize();
      }

    /**

    • @param arg0
    • @param arg1
    • @param arg2
    • @param arg3
      */
      public Login(String arg0, boolean arg1, boolean arg2, boolean arg3) {
      super(arg0, arg1, arg2, arg3);
      // TODO Auto-generated constructor stub
      initialize();
      }

    /**

    • @param arg0
    • @param arg1
    • @param arg2
    • @param arg3
    • @param arg4
      */
      public Login(String arg0, boolean arg1, boolean arg2, boolean arg3,
      boolean arg4) {
      super(arg0, arg1, arg2, arg3, arg4);
      // TODO Auto-generated constructor stub
      initialize();
      }

    /* (non-Javadoc)

    • @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
      
      <em>/
      
      public void actionPerformed(ActionEvent arg0) {
      
      // TODO Auto-generated method stub
      
      }
      
      public static void main(String[] args) {
      
      }
      
      /</em>*
      
    • This method initializes this

    • @return void
      
      <em>/
      
      private void initialize() {
      
      this.setSize(318, 250);
      
      this.setContentPane(getJContentPane());
      
      }
      
      /</em>*
      
    • This method initializes jContentPane

    • @return javax.swing.JPanel
      
      <em>/
      
      private javax.swing.JPanel getJContentPane() {
      
      if(jContentPane == null) {
      
      jContentPane = new javax.swing.JPanel();
      
      jContentPane.setLayout(null);
      
      jContentPane.add(getJLabel(), null);
      
      jContentPane.add(getJLabel1(), null);
      
      jContentPane.add(getJTextField(), null);
      
      jContentPane.add(getJLabel2(), null);
      
      jContentPane.add(getJPasswordField(), null);
      
      jContentPane.add(getJButton(), null);
      
      jContentPane.add(getJButton1(), null);
      
      }
      
      return jContentPane;
      
      }
      
      /</em>*
      
    • This method initializes jLabel

    • @return javax.swing.JLabel

    */
    
    private javax.swing.JLabel getJLabel() {
    
    if (jLabel == null) {
    
    jLabel = new javax.swing.JLabel();
    
    jLabel.setBounds(26, 17, 69, 33);
    
    jLabel.setText(Login);
    
    jLabel.setFont(new java.awt.Font(Comic Sans MS, java.awt.Font.ITALIC, 24));
    
    }
    
    return jLabel;
    
    }
    

    /**

    • This method initializes jLabel1

    • @return javax.swing.JLabel

    */
    
    private javax.swing.JLabel getJLabel1() {
    
    if (jLabel1 == null) {
    
    jLabel1 = new javax.swing.JLabel();
    
    jLabel1.setBounds(27, 71, 42, 19);
    
    jLabel1.setText(“Nome:);
    
    jLabel1.setFont(new java.awt.Font(“Arial”, java.awt.Font.ITALIC, 12));
    
    }
    
    return jLabel1;
    
    }
    

    /**

    • This method initializes jTextField

    • @return javax.swing.JTextField

    */
    
    private javax.swing.JTextField getJTextField() {
    
    if (jTextField == null) {
    
    jTextField = new javax.swing.JTextField();
    
    jTextField.setBounds(27, 90, 171, 20);
    
    }
    
    return jTextField;
    
    }
    

    /**

    • This method initializes jLabel2

    • @return javax.swing.JLabel

    <em>/
    
    private javax.swing.JLabel getJLabel2() {
    
    if (jLabel2 == null) {
    
    jLabel2 = new javax.swing.JLabel();
    
    jLabel2.setBounds(28, 118, 46, 20);
    
    jLabel2.setText(“Senha:”);
    
    jLabel2.setFont(new java.awt.Font(“Arial”, java.awt.Font.ITALIC, 12));
    
    }
    
    return jLabel2;
    
    }
    
    /</em>*
    
    • This method initializes jPasswordField

    • @return javax.swing.JPasswordField

    */
    
    private javax.swing.JPasswordField getJPasswordField() {
    
    if (jPasswordField == null) {
    
    jPasswordField = new javax.swing.JPasswordField();
    
    jPasswordField.setBounds(28, 137, 167, 20);
    
    }
    
    return jPasswordField;
    
    }
    

    /**

    • This method initializes jButton

    • @return javax.swing.JButton

    */
    
    private javax.swing.JButton getJButton() {
    
    if (jButton == null) {
    
    jButton = new javax.swing.JButton();
    
    jButton.setBounds(212, 47, 82, 40);
    
    jButton.setText(OK);
    
    jButton.setFont(new java.awt.Font(Comic Sans MS, java.awt.Font.ITALIC, 10));
    
    jButton.addActionListener(new java.awt.event.ActionListener() {
    
    public void actionPerformed(java.awt.event.ActionEvent e) {    
     			String login= jTextField.getText().trim();
     			String senha= jPasswordField.getText().trim();
     		    String url = "select * from login where usuario ='"+login+"' and senha ='"+senha+"'"; 
     			try {
     				ResultSet rs = ConectorBD.conectar().createStatement().executeQuery(url);
     				if(rs.next())
     				{
     					String tela = rs.getString("TELA");
     					Class.forName(tela,true,ClassLoader.getSystemClassLoader()).newInstance();
     				}
     				else
     					JOptionPane.showMessageDialog(null, "USUARIO INVALIDO");	
     				
     			} catch (SQLException e1) {
     				e1.printStackTrace();
     			} catch (ClassNotFoundException ee) {
     				ee.printStackTrace();
     			} catch (InstantiationException e2) {
     				e2.printStackTrace();
     			} catch (IllegalAccessException e3) {
     				e3.printStackTrace();
     			}
     		}
     	});
    
     }
     return jButton;
    

    }

    /**

    • This method initializes jButton1

    • @return javax.swing.JButton

    */
    
    private javax.swing.JButton getJButton1() {
    
    if (jButton1 == null) {
    
    jButton1 = new javax.swing.JButton();
    
    jButton1.setBounds(213, 106, 81, 36);
    
    jButton1.setText(Cancelar);
    
    jButton1.setFont(new java.awt.Font(Arial, java.awt.Font.ITALIC, 10));
    
    }
    
    return jButton1;
    
    }
    

    } // @jve:visual-info decl-index=0 visual-constraint=“10,10”

bom este é o codigo da classe que quero compilar

A

kra, oq o eclipse está dizendo é q vc está usando um método que está “deprecated”, ou seja, não deve mais ser usado, por algum motivo.

o método no caso, é o getText(), do jPasswordField, ele foi substiuído, pelo método getPassword(), que é o método q vc deve utilizar.

[]'s

S

Olá,

o uso de métodos deprecated não é um erro em si, o compilador está apenas alertando!

Quanto a usar getPassword, o problema é que este retorna um char[], não String.

Daí, para seguir adiante, ou o Dumpa converte este char[] para um String, já que deverá compor a sql, o que na prática reintroduz o problema original que provocou a “depreciação” do getText - segurança

ou segue feliz com getText, sem problemas, se desconsiderar a mensagem na compilação.

bob

C

javac -deprecation nomeDaClasse.java

:razz:

Criado 15 de setembro de 2004
Ultima resposta 15 de set. de 2004
Respostas 5
Participantes 5