Ver Mensaje Individual
  #1 (permalink)  
Antiguo 24/09/2007, 05:01
bezante
 
Fecha de Ingreso: mayo-2007
Mensajes: 9
Antigüedad: 17 años
Puntos: 0
Problema al ejecutar una aplicación GUI

Hola, soy un poco novatillo, a ver si me podéis desatascar en estos primeros pasos. :)

Estoy haciendo una interfaz gráfica con eclipse (con el visual editor) de momento solo tiene un jpanel y una jlabel incrustada en el con un dibujo asociado (un jpeg) en su propiedad ICON. Guardo y ejecuto y me sale la siguiente parrafada:


java.lang.reflect.InvocationTargetException
at sun.reflect.NativeConstructorAccessorImpl.newInsta nce0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInsta nce(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newI nstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at org.eclipse.ve.internal.java.vce.launcher.remotevm .JFCLauncher$1.run(JFCLauncher.java:59)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilter s(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(U nknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarch y(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
Caused by: java.lang.NullPointerException
at javax.swing.ImageIcon.<init>(Unknown Source)
at ex484.TTTBoardPanel.initialize(TTTBoardPanel.java: 33)IWAV0052E Invocation Target Exception creating ex484.TTTBoardPanel

at ex484.TTTBoardPanel.<init>(TTTBoardPanel.java:19)
... 13 more



Lo ha generado el VE de eclipse... asi que hay pocas posibilidades de que halla metido yo la pata. Por si acaso, os 'planto' el codigo:


package ex484;

import java.awt.GridBagLayout;
import javax.swing.JPanel;
import java.awt.Dimension;
import javax.swing.JLabel;
import java.awt.GridBagConstraints;
import javax.swing.ImageIcon;

public class TTTBoardPanel extends JPanel {

private static final long serialVersionUID = 1L;
private JLabel jLabel = null;
/**
* This is the default constructor
*/
public TTTBoardPanel() {
super();
initialize();
}

/**
* This method initializes this
*
* @return void
*/
private void initialize() {
GridBagConstraints gridBagConstraints1 = new GridBagConstraints();
gridBagConstraints1.gridx = 1;
gridBagConstraints1.gridy = 0;
jLabel = new JLabel();
jLabel.setText("JLabel");
jLabel.setIcon(new ImageIcon(getClass().getResource("/small-blue.gif")));
this.setSize(829, 377);
this.setLayout(new GridBagLayout());
this.add(jLabel, gridBagConstraints1);
}


Algun consejo??