Search:

Type: Posts; User: jocdrew21

Page 1 of 11 1 2 3 4

Search: Search took 0.28 seconds.

  1. Replies
    4
    Views
    91

    [SOLVED] Re: Create a matrix of JTextFields

    box = new JTextField[row][col];


    Thank you
  2. Replies
    4
    Views
    91

    [SOLVED] Re: Create a matrix of JTextFields

    Thats what I thought I was doing when I did



    box[i][j] = new JTextField();
  3. Replies
    4
    Views
    91

    [SOLVED] Create a matrix of JTextFields

    I am making a Sudoku game and creating a matrix of JTextFields. However I am getting the following errors


    Exception in thread "main" java.lang.NullPointerException
    at...
  4. Re: Homework Assignment: Nested while loop and do...while loop

    Are you set on using a while loop? This would be much easier on you if you used two loops, one of which is nested.
  5. Replies
    2
    Views
    148

    Re: reading a file:

    This is the most recent JD7, this is the only reason I asked. I just wanted to know why it was bette then what I was used to using.
  6. Replies
    2
    Views
    148

    reading a file:

    just found this link Java Practices -> Reading and writing text files

    I have been using File, BufferReader etc. This used the following:



    import java.io.BufferedReader;
    import...
  7. Replies
    75
    Views
    654

    Re: getting an object from a hashMap:

    sorry got it...
  8. Replies
    75
    Views
    654

    Re: getting an object from a hashMap:

    I need an instance of the camera class because I am getting the distance between camera from it. My error was I was not creating a Camera fully. I was just doing the following:

    Camera camera
    I...
  9. Replies
    75
    Views
    654

    Re: getting an object from a hashMap:

    Found it but it is still puzzling...

    The parameters are getting values, no issue there. When I sent the value to the camera class in the getDistance method I get the...
  10. Replies
    75
    Views
    654

    Re: getting an object from a hashMap:

    I am not sure I understood the question:

    setDistanceTraveled() is in the vehicle class as post below.



    package online.practice.averageSpeed;

    public class Vehicle {
  11. Replies
    75
    Views
    654

    Re: getting an object from a hashMap:

    Yes, how could it not be? It is from the vehicle class that I am putting into a ArrayList. This confuses me greatly!
  12. Replies
    75
    Views
    654

    Re: getting an object from a hashMap:

    Lines 48-50 are:


    plates = info[0];
    cam = info[1];
    time = info[2];


    When I put print statements there they are getting the values. I even confirm by putting more println statements in the...
  13. Replies
    75
    Views
    654

    Re: getting an object from a hashMap:

    You're correct I am not getting errors anymore and good lesson was learned here. I am getting now output at all now.. Then I thought it is because the values are not speeding in the test i created....
  14. Replies
    75
    Views
    654

    Re: getting an object from a hashMap:

    I am feeling pretty dumb at the moment. Why would it matter what I put first, I used &&? Just to double check I checked your advice and the same thing happened. I even replaced the for loop with a...
  15. Replies
    75
    Views
    654

    Re: getting an object from a hashMap:

    Norm I tip my hat to you and thank you... However I am still seeing my check && i+1 < v.size() in the loop....



    if(currentV.getLicensePlates().equals(nextV.getLicensePlates())
    && i+1 <...
  16. Replies
    75
    Views
    654

    Re: getting an object from a hashMap:

    if(v.get(i).getLicensePlates().equals(v.get(i+1).getLicensePlates())
    && i+1 < v.size()){


    Greg you did not post the full code, the check is posted above.

    Norm:
    I had to call it the way...
  17. Replies
    75
    Views
    654

    Re: getting an object from a hashMap:

    sorry I posted it in the other post and I commented on the error too.


    void calculateSpeed(ArrayList<Vehicle> v){
    int cam1,cam2;
    int speed1,speed2;

    for(int i=0;i<v.size();i++){
    ...
  18. Replies
    75
    Views
    654

    Re: getting an object from a hashMap:

    Correction has been made above. I forgot to add \n in the StringReader....

    --- Update ---

    As far and the out of bound exception the only place it could be is below and I did a check for that:
    ...
  19. Replies
    75
    Views
    654

    Re: getting an object from a hashMap:

    As per your request norm:



    package online.practice.averageSpeed;

    import java.io.BufferedReader;
    import java.io.File;
    import java.io.FileReader;
    import java.io.IOException;
  20. Replies
    75
    Views
    654

    Re: getting an object from a hashMap:

    The only way I can do this is to post two classes:



    package online.practice.averageSpeed;

    import java.io.BufferedReader;
    import java.io.File;
    import java.io.FileReader;
    import...
  21. Replies
    75
    Views
    654

    Re: getting an object from a hashMap:

    Greg:

    I am confused because it appears I am calling them correctly. I am not questioning you because obviously I am wrong I just do not know why. I created new fields and set them to a index of...
  22. Replies
    75
    Views
    654

    Re: getting an object from a hashMap:

    I am trying to call methods from the vehicle class inside the below method. Post #40 has the full code if you want to view the vehicle class.

    The error says I need to ass a cast to v but when I do...
  23. Replies
    75
    Views
    654

    Re: getting an object from a hashMap:

    This is my very last method and the code is solved. I am unable to call method even though I am sending it in to the method in a ArrayList. Why can I not call methods in the class?



    void...
  24. Replies
    75
    Views
    654

    Re: getting an object from a hashMap:

    You have to be kidding me. Creating a new Vehicle instance inside the while loop....
  25. Replies
    75
    Views
    654

    Re: getting an object from a hashMap:

    Norm just before I add the vehicle to the ArrayList I print this


    System.out.println("adding new vehicle number: "+vehicle.getLicensePlates()); //in while loop


    After the loop I close the...
Results 1 to 25 of 270
Page 1 of 11 1 2 3 4