Search:

Type: Posts; User: meni

Search: Search took 0.08 seconds.

  1. Replies
    44
    Views
    5,053

    Re: Having a NullPointerException

    Then I don't get it.

    'vehicle' is the variable of the class Vehicle, right?
    Obviously I am wrong, but when the vehicle is called, wouldn't it pull the constructor of the class Vehicle?
  2. Replies
    44
    Views
    5,053

    Re: Having a NullPointerException

    I cut and pasted from my first post, sorry. Adding those methods were the only things I did on my copy.

    This is the same problem I've been having since yesterday. I am sorry; I am just not...
  3. Replies
    44
    Views
    5,053

    Re: Having a NullPointerException

    I keep getting a NullPointerException at this line, which is in the pAddVehicle class


    vehicle.addItem(ma, mo,co, numD, numC, p);
  4. Replies
    44
    Views
    5,053

    Re: Having a NullPointerException

    import javax.swing.*;

    public class PRJ03 extends JFrame
    {
    public static void main (String [] args)
    {
    Vehicle vehicle;
    pAddVehicle pnlAdd;
    pShowVehicle pnlShow;
  5. Replies
    44
    Views
    5,053

    Re: Having a NullPointerException

    Then I am confused. I thought if there was not a value assigned, it would refer to the constructor?
  6. Replies
    44
    Views
    5,053

    Re: Having a NullPointerException

    Ok, so I am back. The break worked somewhat, I got my other project done fast. This one is still stumping me.

    So with that statement in main creating an instance of the Vehicle class and my...
  7. Replies
    44
    Views
    5,053

    Re: Having a NullPointerException

    I'll come back later. I am taking a break For food and to clear my head, like has been written.
  8. Replies
    44
    Views
    5,053

    Re: Having a NullPointerException

    Ok so in pAddVehicle class



    private Vehicle vehicle;

    Is instantiating the Vehicle class to use, right?

    but in my Vehicle class, this
  9. Replies
    44
    Views
    5,053

    Re: Having a NullPointerException

    I'm sorry, I don't see why it didn't.
  10. Replies
    44
    Views
    5,053

    Re: Having a NullPointerException

    It is also null. I've referenced it and such, just like you were saying with the other problem. It is listed.

    Sorry, just getting frustrated with this one. I've even tried stepping on to another...
  11. Replies
    44
    Views
    5,053

    Re: Having a NullPointerException

    pnlAdd.setOrderPanel(pnlShow);


    I put that into my main program, if thinking right. And now get a NullPointerException at


    vehicle.addItem(ma, mo,co, numD, numC, p);


    which I already had...
  12. Replies
    44
    Views
    5,053

    Re: Having a NullPointerException

    We never called it in our class example and it worked. That is what is throwing me off then. What constructor then?
  13. Replies
    44
    Views
    5,053

    Re: Having a NullPointerException

    public void setOrderPanel(pShowVehicle p)
    {
    pnlShow = p;
    }


    I thought that is what this did? The only notes I have, is the program we did in class that day. So I am looking off...
  14. Replies
    44
    Views
    5,053

    Re: Having a NullPointerException

    That variable is just declaration of the pShowVehicle panel. You can print that?

    That was new to me. I tried it and pnlShow has a null value. So i need to make a constructor on the pShowVehicle...
  15. Replies
    44
    Views
    5,053

    Re: Having a NullPointerException

    System.out.println(pnlShow.doSomething());


    Ok, I put this line in right before that line and it can't resolve the println void. I know I am missing something common, but I can't think what. This...
  16. Replies
    44
    Views
    5,053

    Re: Having a NullPointerException

    When I ran it, it never showed up on that panel. Hmm, the method was what I was going to use to spit out the contents of the Vector.

    When I attempt to add it back, I get the NullPointerException...
  17. Replies
    44
    Views
    5,053

    Re: Having a NullPointerException

    After I fixed all of it, I thought about this. It didn't click still why. Since in my pnlShow class, doSomething was written as:


    public void doSomething()
    {
    ...
  18. Replies
    44
    Views
    5,053

    Re: Having a NullPointerException

    After finding the line, it was this snippet of code:


    pnlShow.doSomething();


    Thank you so much for your help! Now to try and display the Vector
  19. Replies
    44
    Views
    5,053

    Re: Having a NullPointerException

    I'm sorry. Like I initially said, I've been up too long looking at different projects and code, my mind is melting. Ok, when I did that, I get this
  20. Replies
    44
    Views
    5,053

    Re: Having a NullPointerException

    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;

    public class pAddVehicle extends JPanel implements ActionListener
    {
    ...
  21. Replies
    44
    Views
    5,053

    Re: Having a NullPointerException

    I am confused on what you are asking. My professor never explained that. It was more of a this is what you type, and this is what it does. If the program didn't do what he wanted, he got real quiet...
  22. Replies
    44
    Views
    5,053

    Re: Having a NullPointerException

    Ok sorry. In my txtOutput box, I get this:

    java.lang.NullPointerException
  23. Replies
    44
    Views
    5,053

    Having a NullPointerException

    Ok, I am trying to do another class project and I keep getting a NullPointerException showing up on the txtOutput line. The main goal of this project is to have a driver program with the 2 paned tab....
Results 1 to 23 of 23