Hi
i am writing a code which is using an array of objects ... when i try to run the code it gives me a nullpointer exception on line 24
Code:
import java.awt.Rectangle;
import java.awt.Color;
import javax.swing.*;
public class NewReport extends JInternalFrame{
private JPanel reportPanel = new JPanel();
private JLabel[] textLabels = new JLabel[10];
public NewReport(Rectangle r) {
super.setTitle("Report");
super.setSize(r.width, r.height);
super.setClosable(true);
super.setIconifiable(true);
super.setMaximizable(true);
getContentPane().add(reportPanel);
super.setBackground(Color.WHITE);
reportPanel.setLayout(null);
paintDesktop();
}
private void paintDesktop() {
//JLabel toLabel = new JLabel();
textLabels[0].setText("To"); // line 24
textLabels[0].setBounds(4,12,16,11);
reportPanel.add(textLabels[0]);
}
}
where am i going wrong
thanks