#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2012
    Posts
    4
    Rep Power
    0

    Tough 2D arrays problem


    Figured it out, thanks all! Closing thread.
  2. #2
  3. Contributing User
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Aug 2010
    Location
    Eastern Florida
    Posts
    3,714
    Rep Power
    348
    Where is the objectdraw package defined? Without that the code won't compile for testing. Or you could rewrite the code to use java SE so it could be compiled and executed for testing.
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2012
    Posts
    4
    Rep Power
    0
    Originally Posted by NormR
    Where is the objectdraw package defined? Without that the code won't compile for testing. Or you could rewrite the code to use java SE so it could be compiled and executed for testing.
    Oh, sorry for not specifying - the forum isn't allowing me to post the objectdraw library due to forum rules, but it's the first google result for 'objectdraw' - it's just a tool for making simple graphical objects and is used to teach introductory Java. I can rewrite the code if it's too much trouble.
  6. #4
  7. Contributing User
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Aug 2010
    Location
    Eastern Florida
    Posts
    3,714
    Rep Power
    348
    What is this line for? I get a compiler error because of missing return type:
    Code:
     
        //to help start the program in BlueJ
        public EmergenceUpdated(){
    That's not the name of the class.


    Also there is no main() method, so the code can not be executed with the java command.

    I'm done for tonight, back tomorrow.
    Last edited by NormR; December 17th, 2012 at 08:50 PM.
  8. #5
  9. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2012
    Posts
    4
    Rep Power
    0
    Originally Posted by NormR
    What is this line for? I get a compiler error because of missing return type:
    Code:
     
        //to help start the program in BlueJ
        public EmergenceUpdated(){
    That's not the name of the class.


    Also there is no main() method, so the code can not be executed with the java command.

    I'm done for tonight, back tomorrow.
    Oh, whoops. First part was sloppy work on my part - I forgot to change it in the header, had it as "updated" when I was still working on it because I was looking at multiple versions and trying not to confuse myself. I'll go edit it -thank you for your time!
  10. #6
  11. Contributing User
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Aug 2010
    Location
    Eastern Florida
    Posts
    3,714
    Rep Power
    348
    The posted code does not compile without errors:

    non-static method createGrid() cannot be referenced from a static context
  12. #7
  13. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2012
    Posts
    4
    Rep Power
    0
    Originally Posted by NormR
    The posted code does not compile without errors:

    non-static method createGrid() cannot be referenced from a static context
    Really strange. I'm going to edit the OP - when I compile the code, it works fine - I get a grid in my display window of assorted red/green colored dots. Upon clicking the grid, all dots turn red. I have everything else done, I just need help conceptually thinking of a way to have members of the array "recognize" the dominant color among their neighbors (so in a given slot, a red dot surrounded by five green and four red dots will change color to green).
  14. #8
  15. Contributing User
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Aug 2010
    Location
    Eastern Florida
    Posts
    3,714
    Rep Power
    348
    There is no main() method in the posted code so it can not be executed with the java command:
    java EmergenceUpdated

IMN logo majestic logo threadwatch logo seochat tools logo