Exception in thread "main" java.lang.NullPointerException

import java.awt.Container;

import java.awt.event.ActionEvent;

import java.awt.event.ActionListener;

import javax.swing.*;

/*

* UserInterface.java

* @author tristan

* Created on April 15, 2007, 5:45 PM

*/

publicclass UserInterfaceextends JFrameimplements ActionListener{

//Declare member variables

private JLabel monthLabel =new JLabel();

private JTextField month =new JTextField();

private JLabel dayLabel =new JLabel();

private JTextField day =new JTextField();

private JLabel yearLabel =new JLabel();

private JTextField year =new JTextField();

//CalendarManager

private JTextArea entry =new JTextArea();

private JButton saveEntry;

private JButton getEntry;

public UserInterface(){

//... Build the content pane.

Container content = this.getContentPane();

content.add(monthLabel);// Add components to the content

content.add(month);

content.add(dayLabel);

content.add(day);

content.add(yearLabel);

content.add(year);

content.add(entry);

content.add(saveEntry);

content.add(getEntry);

this.setTitle("Calendar Program");

this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

this.pack();// does layout of components.

}//end constructor

publicstaticvoid main(String[] args){

JFrame window =new UserInterface();

window.setVisible(true);

}

publicvoid actionPerformed(ActionEvent e){

}

}

I've never had this happen before. Why am I getting a null exception? The full error is: Exception in thread"main" java.lang.NullPointerException

at java.awt.Container.addImpl(Container.java:1027)

at java.awt.Container.add(Container.java:352)

at UserInterface.<init>(UserInterface.java:34)

at UserInterface.main(UserInterface.java:55)

[3472 byte] By [tristanlee85a] at [2007-11-27 1:07:48]
# 1
you try to add:content.add(saveEntry);content.add(getEntry);whereas they have not been initialized yet
calvino_inda at 2007-7-11 23:43:05 > top of Java-index,Java Essentials,Java Programming...
# 2
I've been starring at this for about 45 mins now. Unbelievable. Thanks.
tristanlee85a at 2007-7-11 23:43:05 > top of Java-index,Java Essentials,Java Programming...