ola,
tenho um painel que crio apos fazer uma pesquisa no banco de dados até ai tudo bem ele pesquiso e eu consigo adicionar o resultado na tela mas apos isto ocorre este erro
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
at efetuaPagamento.registraPagamento(efetuaPagamento.java:339)
at efetuaPagamento$3.actionPerformed(efetuaPagamento.java:187)
at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
meu codigo é este
[code]try
{
int q=0;
int x=30;
int y=20;
JPanel panel=new JPanel();
panel.setBounds(y, 270, 500, 200);
panel.setBackground(Color.cyan);
int maior=0,num1=0;
System.out.println("select parcelas from financeiro where rc_aluno='"+ t2.getText() +"'");
resultado = comando.executeQuery("select parcelas from financeiro where rc_aluno='"+ t2.getText() +"'");
while(resultado.next())
{
l[q]=new JLabel(resultado.getObject(1).toString());
q++;
}
for(int i=0;i<l.length;i++)
{
if(l[i].getText()!=null)//o erro aponta para esta linha
{
num1=Integer.parseInt(l[i].getText());
if(maior<num1)
{
maior=num1;
System.out.println("o maior é "+maior+" num1 é "+num1);
l[i].setBounds (20, x,120, 25);
panel.add(l[i]);
tela.add(panel);
repaint();
x+=30;
}
}
}
System.out.println("fora do if\n o maior é "+maior+" num1 é "+num1);
//ver qts parcelas tm dai d acordo com este num sao criados as caixas d txt no painel
//depois add na tela
}
catch(SQLException er)
{
er.printStackTrace();
}
}[/code]
alguém pode me ajudar a encontrar o erro?
obrigada