elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: Los 10 CVE más críticos (peligrosos) de 2020


+  Foro de elhacker.net
|-+  Programación
| |-+  Programación General
| | |-+  Java
| | | |-+  contentPane:java.lang.IllegalArgumentException
0 Usuarios y 1 Visitante están viendo este tema.
Páginas: [1] Ir Abajo Respuesta Imprimir
Autor Tema: contentPane:java.lang.IllegalArgumentException  (Leído 4,537 veces)
[GB]

Desconectado Desconectado

Mensajes: 30


Ver Perfil
contentPane:java.lang.IllegalArgumentException
« en: 22 Noviembre 2009, 01:44 am »

Estaba con el VE del Eclipse y derrepente se me quedo todo el Jframe en blanco con una I de informacion arriba del todo con e siguiente mensaje:

Citar
contentPane:java.lang.IllegalArgumentException(IWAV0167E access by methodname(getContentPane) (not by Proxy) requires a receiver.)

Lo curioso es que puedo compilarlo sin problemas, solo que no veo los Jtext y jButtons que habia agregado ... alguna idea de donde puede estar el problema?.. dejo el código completo a continuación... si me pueden ayudar bárbaro, gracias ...
Código:
package IU;

import java.awt.BorderLayout;

import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JFrame;
import javax.swing.JTextField;
import java.awt.Rectangle;
import javax.swing.JLabel;
import java.awt.Dimension;
import javax.swing.JButton;
import java.awt.Point;
import javax.swing.JPasswordField;

import dominio.Administrador;

import servicio.Fachada;
import utilidades.Consola;

public class IUAgregarAdm extends JFrame {

private static final long serialVersionUID = 1L;
private JPanel jContentPane = null;
private JTextField jNombre = null;
private JTextField jApellido = null;
private JTextField jUser = null;
private JLabel jLabel = null;
private JLabel jLabel1 = null;
private JLabel jLabel2 = null;
private JLabel jPass = null;
private JButton jAceptar = null;
private JButton jCancel = null;
private JPasswordField jPasswordField = null;

private Fachada f;
private JLabel jPassC = null;
private JPasswordField jPasswordField1 = null;

/**
* This is the default constructor
*/
public IUAgregarAdm(Fachada v) {
super();
initialize();
v = f;
}

/**
* This method initializes this
*
* @return void
*/
private void initialize() {
this.setSize(256, 220);
this.setResizable(false);
this.setContentPane(getJContentPane());
this.setTitle("Agregar administrador");
}

/**
* This method initializes jContentPane
*
* @return javax.swing.JPanel
*/
private JPanel getJContentPane() {
if (jContentPane == null) {
jPassC = new JLabel();
jPassC.setBounds(new Rectangle(19, 113, 88, 16));
jPassC.setText("Confirma Pass:");
jPass = new JLabel();
jPass.setBounds(new Rectangle(19, 92, 82, 16));
jPass.setText("Password:");
jLabel2 = new JLabel();
jLabel2.setBounds(new Rectangle(19, 69, 38, 16));
jLabel2.setText("User:");
jLabel1 = new JLabel();
jLabel1.setBounds(new Rectangle(19, 50, 59, 16));
jLabel1.setText("Apellido:");
jLabel = new JLabel();
jLabel.setBounds(new Rectangle(19, 28, 64, 16));
jLabel.setText("Nombre:");
jContentPane = new JPanel();
jContentPane.setLayout(null);
jContentPane.add(getJNombre(), null);
jContentPane.add(getJApellido(), null);
jContentPane.add(getJUser(), null);
jContentPane.add(jLabel, null);
jContentPane.add(jLabel1, null);
jContentPane.add(jLabel2, null);
jContentPane.add(jPass, null);
jContentPane.add(getJAceptar(), null);
jContentPane.add(getJCancel(), null);
jContentPane.add(getJPasswordField(), null);
jContentPane.add(jPassC, null);
jContentPane.add(getJPasswordField1(), null);
}
return jContentPane;
}

/**
* This method initializes jNombre
*
* @return javax.swing.JTextField
*/
private JTextField getJNombre() {
if (jNombre == null) {
jNombre = new JTextField();
jNombre.setBounds(new Rectangle(110, 27, 119, 20));
}
return jNombre;
}

/**
* This method initializes jApellido
*
* @return javax.swing.JTextField
*/
private JTextField getJApellido() {
if (jApellido == null) {
jApellido = new JTextField();
jApellido.setBounds(new Rectangle(110, 49, 119, 20));
}
return jApellido;
}

/**
* This method initializes jUser
*
* @return javax.swing.JTextField
*/
private JTextField getJUser() {
if (jUser == null) {
jUser = new JTextField();
jUser.setBounds(new Rectangle(110, 71, 119, 20));
}
return jUser;
}

/**
* This method initializes jAceptar
*
* @return javax.swing.JButton
*/
private JButton getJAceptar() {
if (jAceptar == null) {
jAceptar = new JButton();
jAceptar.setBounds(new Rectangle(144, 153, 83, 25));
jAceptar.setText("Aceptar");
jAceptar.setToolTipText("");
jAceptar.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
                    crearAdm();
}
});
}
return jAceptar;
}

private boolean crearAdm() {
String nombre; String apellido; String user; String pass;

if (this.noHayErrores()) {
nombre = this.jNombre.getText();
apellido = this.jApellido.getText();
user = this.jUser.getText();
pass = this.jPasswordField.getText();

Administrador adm = new Administrador(nombre,apellido,user,pass);
if (f.agregarAdmin(adm)) {
return true;
}
}
return false;
}

/**
* This method initializes jCancel
*
* @return javax.swing.JButton
*/
private JButton getJCancel() {
if (jCancel == null) {
jCancel = new JButton();
jCancel.setBounds(new Rectangle(22, 153, 83, 25));
jCancel.setText("Salir");
}
return jCancel;
}

/**
* This method initializes jPasswordField
*
* @return javax.swing.JPasswordField
*/
private JPasswordField getJPasswordField() {
if (jPasswordField == null) {
jPasswordField = new JPasswordField();
jPasswordField.setBounds(new Rectangle(110, 93, 119, 20));
}
return jPasswordField;
}

/**
* This method initializes jPasswordField1
*
* @return javax.swing.JPasswordField
*/
private JPasswordField getJPasswordField1() {
if (jPasswordField1 == null) {
jPasswordField1 = new JPasswordField();
jPasswordField1.setBounds(new Rectangle(110, 115, 119, 20));
}
return jPasswordField1;
}

public boolean noHayErrores() {

if (this.jNombre.getText().trim().isEmpty()) {
JOptionPane.showMessageDialog(this, "Falta ingresar el Nombre");
return false;
}
if (this.jApellido.getText().trim().isEmpty()) {
JOptionPane.showMessageDialog(this, "Falta ingresar el Apellido");
return false;
}
if (this.jUser.getText().trim().isEmpty()) {
JOptionPane.showMessageDialog(this,
"Falta ingresar el Nombre de Usuario");
return false;
}

if (this.jPasswordField.getText().trim().isEmpty()) {
JOptionPane.showMessageDialog(this,
"Falta ingresar el Password");
return false;
}

if (this.jPasswordField1.getText().trim().isEmpty()) {
JOptionPane.showMessageDialog(this,
"Falta ingresar la confirmacion del Password");
return false;
}

if (!this.jPasswordField1.getText().equals(this.jPasswordField.getText())) {
JOptionPane.showMessageDialog(this,
"Los Passwords ingresados no coinciden");
return false;
}

/*
* /if (modelo.buscarJugadorxNom(this.Usuario.getText())) {
* JOptionPane.showMessageDialog(this,
* "Error, ya existe un usuario con el mismo nombre."); return false; }/
*/

return true;

}

} // @jve:decl-index=0:visual-constraint="10,10"
/code]


En línea

Blitzkrieg'


Desconectado Desconectado

Mensajes: 546


print('Hi there')


Ver Perfil WWW
Re: contentPane:java.lang.IllegalArgumentException
« Respuesta #1 en: 22 Noviembre 2009, 05:04 am »

Hola amigo, te recomiendo que uses Layout managers para organizar tus componentes en tu GUI  ;D


En línea



Debci
Wiki

Desconectado Desconectado

Mensajes: 2.021


Actualizate o muere!


Ver Perfil WWW
Re: contentPane:java.lang.IllegalArgumentException
« Respuesta #2 en: 22 Noviembre 2009, 11:23 am »

Estaba con el VE del Eclipse y derrepente se me quedo todo el Jframe en blanco con una I de informacion arriba del todo con e siguiente mensaje:

Citar
contentPane:java.lang.IllegalArgumentException(IWAV0167E access by methodname(getContentPane) (not by Proxy) requires a receiver.)

Lo curioso es que puedo compilarlo sin problemas, solo que no veo los Jtext y jButtons que habia agregado ... alguna idea de donde puede estar el problema?.. dejo el código completo a continuación... si me pueden ayudar bárbaro, gracias ...
Código:
package IU;

import java.awt.BorderLayout;

import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JFrame;
import javax.swing.JTextField;
import java.awt.Rectangle;
import javax.swing.JLabel;
import java.awt.Dimension;
import javax.swing.JButton;
import java.awt.Point;
import javax.swing.JPasswordField;

import dominio.Administrador;

import servicio.Fachada;
import utilidades.Consola;

public class IUAgregarAdm extends JFrame {

private static final long serialVersionUID = 1L;
private JPanel jContentPane = null;
private JTextField jNombre = null;
private JTextField jApellido = null;
private JTextField jUser = null;
private JLabel jLabel = null;
private JLabel jLabel1 = null;
private JLabel jLabel2 = null;
private JLabel jPass = null;
private JButton jAceptar = null;
private JButton jCancel = null;
private JPasswordField jPasswordField = null;

private Fachada f;
private JLabel jPassC = null;
private JPasswordField jPasswordField1 = null;

/**
* This is the default constructor
*/
public IUAgregarAdm(Fachada v) {
super();
initialize();
v = f;
}

/**
* This method initializes this
*
* @return void
*/
private void initialize() {
this.setSize(256, 220);
this.setResizable(false);
this.setContentPane(getJContentPane());
this.setTitle("Agregar administrador");
}

/**
* This method initializes jContentPane
*
* @return javax.swing.JPanel
*/
private JPanel getJContentPane() {
if (jContentPane == null) {
jPassC = new JLabel();
jPassC.setBounds(new Rectangle(19, 113, 88, 16));
jPassC.setText("Confirma Pass:");
jPass = new JLabel();
jPass.setBounds(new Rectangle(19, 92, 82, 16));
jPass.setText("Password:");
jLabel2 = new JLabel();
jLabel2.setBounds(new Rectangle(19, 69, 38, 16));
jLabel2.setText("User:");
jLabel1 = new JLabel();
jLabel1.setBounds(new Rectangle(19, 50, 59, 16));
jLabel1.setText("Apellido:");
jLabel = new JLabel();
jLabel.setBounds(new Rectangle(19, 28, 64, 16));
jLabel.setText("Nombre:");
jContentPane = new JPanel();
jContentPane.setLayout(null);
jContentPane.add(getJNombre(), null);
jContentPane.add(getJApellido(), null);
jContentPane.add(getJUser(), null);
jContentPane.add(jLabel, null);
jContentPane.add(jLabel1, null);
jContentPane.add(jLabel2, null);
jContentPane.add(jPass, null);
jContentPane.add(getJAceptar(), null);
jContentPane.add(getJCancel(), null);
jContentPane.add(getJPasswordField(), null);
jContentPane.add(jPassC, null);
jContentPane.add(getJPasswordField1(), null);
}
return jContentPane;
}

/**
* This method initializes jNombre
*
* @return javax.swing.JTextField
*/
private JTextField getJNombre() {
if (jNombre == null) {
jNombre = new JTextField();
jNombre.setBounds(new Rectangle(110, 27, 119, 20));
}
return jNombre;
}

/**
* This method initializes jApellido
*
* @return javax.swing.JTextField
*/
private JTextField getJApellido() {
if (jApellido == null) {
jApellido = new JTextField();
jApellido.setBounds(new Rectangle(110, 49, 119, 20));
}
return jApellido;
}

/**
* This method initializes jUser
*
* @return javax.swing.JTextField
*/
private JTextField getJUser() {
if (jUser == null) {
jUser = new JTextField();
jUser.setBounds(new Rectangle(110, 71, 119, 20));
}
return jUser;
}

/**
* This method initializes jAceptar
*
* @return javax.swing.JButton
*/
private JButton getJAceptar() {
if (jAceptar == null) {
jAceptar = new JButton();
jAceptar.setBounds(new Rectangle(144, 153, 83, 25));
jAceptar.setText("Aceptar");
jAceptar.setToolTipText("");
jAceptar.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
                    crearAdm();
}
});
}
return jAceptar;
}

private boolean crearAdm() {
String nombre; String apellido; String user; String pass;

if (this.noHayErrores()) {
nombre = this.jNombre.getText();
apellido = this.jApellido.getText();
user = this.jUser.getText();
pass = this.jPasswordField.getText();

Administrador adm = new Administrador(nombre,apellido,user,pass);
if (f.agregarAdmin(adm)) {
return true;
}
}
return false;
}

/**
* This method initializes jCancel
*
* @return javax.swing.JButton
*/
private JButton getJCancel() {
if (jCancel == null) {
jCancel = new JButton();
jCancel.setBounds(new Rectangle(22, 153, 83, 25));
jCancel.setText("Salir");
}
return jCancel;
}

/**
* This method initializes jPasswordField
*
* @return javax.swing.JPasswordField
*/
private JPasswordField getJPasswordField() {
if (jPasswordField == null) {
jPasswordField = new JPasswordField();
jPasswordField.setBounds(new Rectangle(110, 93, 119, 20));
}
return jPasswordField;
}

/**
* This method initializes jPasswordField1
*
* @return javax.swing.JPasswordField
*/
private JPasswordField getJPasswordField1() {
if (jPasswordField1 == null) {
jPasswordField1 = new JPasswordField();
jPasswordField1.setBounds(new Rectangle(110, 115, 119, 20));
}
return jPasswordField1;
}

public boolean noHayErrores() {

if (this.jNombre.getText().trim().isEmpty()) {
JOptionPane.showMessageDialog(this, "Falta ingresar el Nombre");
return false;
}
if (this.jApellido.getText().trim().isEmpty()) {
JOptionPane.showMessageDialog(this, "Falta ingresar el Apellido");
return false;
}
if (this.jUser.getText().trim().isEmpty()) {
JOptionPane.showMessageDialog(this,
"Falta ingresar el Nombre de Usuario");
return false;
}

if (this.jPasswordField.getText().trim().isEmpty()) {
JOptionPane.showMessageDialog(this,
"Falta ingresar el Password");
return false;
}

if (this.jPasswordField1.getText().trim().isEmpty()) {
JOptionPane.showMessageDialog(this,
"Falta ingresar la confirmacion del Password");
return false;
}

if (!this.jPasswordField1.getText().equals(this.jPasswordField.getText())) {
JOptionPane.showMessageDialog(this,
"Los Passwords ingresados no coinciden");
return false;
}

/*
* /if (modelo.buscarJugadorxNom(this.Usuario.getText())) {
* JOptionPane.showMessageDialog(this,
* "Error, ya existe un usuario con el mismo nombre."); return false; }/
*/

return true;

}

} // @jve:decl-index=0:visual-constraint="10,10"
/code]
Organizate mejor la gui y veras lo que falla, la veo muy sobrecargada xD
Quizas sea porque uso netbeans....

Saludos
En línea

[GB]

Desconectado Desconectado

Mensajes: 30


Ver Perfil
Re: contentPane:java.lang.IllegalArgumentException
« Respuesta #3 en: 23 Noviembre 2009, 01:55 am »

Bueno antes que nada gracias por la atención xD

Revise y revise el 80 veces y no encontré nada... pff al final me copie el código de la clase en bloc de notas, borre la clase, agregue de nuevo otra visual class con el mismo nombre y pegue en la nueva clase de nuevo el código anterior y listo ya no me da mas problemas  :xD

Que bizarro, no entiendo que fue lo que paso pero bueno se soluciono xD ...
En línea

Páginas: [1] Ir Arriba Respuesta Imprimir 

Ir a:  

WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines