Welcome to the Java Programming Forums

The professional, friendly Java community. 21,500 members and growing!

The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: Problems with Carrental program

  1. #1
    Junior Member
    Join Date
    Jan 2014
    Thanked 0 Times in 0 Posts

    Default Problems with Carrental program

    Hi, I can't search bookings in my carrental program. I get:

    "Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException"

    the line that needs to be corrected is:
    (first line is working)

    textFieldDate.setText(controller.findBooking(textF ieldBookingNo.getText()).getDate());
    textFieldCustomerNo.setText(controller.findBooking (textFieldBookingNo.getText()).getCustomer().getCu stomerNo());
    textFieldRegNo.setText(controller.findBooking(text FieldBookingNo.getText()).getVehicle().getRegNo()) ;

    When I try to get the date, CustomerNo and the Vehicle, only the date works. The only diffenence between the lines is that the first one is getting the Strings from the class "Booking" and the two other lines get the Strings from 2 classes.("Vehicle" and "Customer")

  2. #2
    Super Moderator
    Join Date
    Jun 2013
    So. Maryland, USA
    My Mood
    Thanked 698 Times in 680 Posts

    Default Re: Problems with Carrental program

    Welcome to the forum! Please read this topic to learn how to post code in code or highlight tags and other useful info for newcomers.

Similar Threads

  1. CSC Basics - Final Program Problems
    By TylerJH7 in forum What's Wrong With My Code?
    Replies: 5
    Last Post: December 3rd, 2013, 04:56 PM
  2. guess program problems.
    By shin777 in forum What's Wrong With My Code?
    Replies: 2
    Last Post: October 31st, 2013, 07:15 AM
  3. Replies: 5
    Last Post: May 9th, 2013, 03:31 PM
  4. Problems with my prime finder program
    By Truck35 in forum What's Wrong With My Code?
    Replies: 6
    Last Post: December 9th, 2012, 12:56 PM
  5. Textpad Program Running Problems
    By Paddy in forum Java IDEs
    Replies: 4
    Last Post: January 27th, 2010, 09:14 PM