I assume you mean the 'getNearby(int)' method? It is a static method (check the documentation), as such, it doesn't matter what you prefix it with (as long as it's a UserInfo instance, or the UserInfo class name). You should really call it as 'UserInfo.getNearby(...)'.
Sorry, but yes, I did mean the 'UserInfo getNearby(...)' method. But why is it, that on my laptop, it works like it should (from what you are telling me), and on the Greenfoot site, it does not appear to be doing what it should.
Here is what I am doing: first, I use the UserInfo 'getTop(...)' method to get the first 15 UserInfo objects. Then, I use the UserInfo 'getNearby(...)' method using the last UserInfo object returned from the UserInfo 'getTop(...)' call. The same code should work the same on the site as on my laptop, but on the site, I only end up with the first set of UserInfo object returned by the UserInfo 'getTop(...)' call and no more, even though more UserInfo objects are there to retrieve. Any idea why that is?
For one thing, I think you've misunderstood me. It doesn't matter what object you use to invoke the getNearby() method, it's a static method so the object is ignored - it always returns entries surrounding the current user. You shouldn't really invoke it with an object, you should invoke it as "UserInfo.getNearby(...)"; the fact that you can invoke it with an object is just a peculiarity of Java.
I was not aware of that particular peculiarity of Java. However, then, it is not working properly in the USB version. Maybe it is an instance method there, instead of being static, because when I prefix it with a UserInfo object, it returns those users around it (not the current user). In other words, this may be a bug in the at-home coding of this method in the USB version for Windows.
With this new understanding, I do realize what I need to do (code-wise) to accomplish that which I want to do. I was hoping I would not have to go that route, though.
THANKS.
danpost, I've double-checked and the getNearby(...) method in UserInfo is definitely static, even in the USB version. So it can't possibly make a difference what object you use to invoke it. I hope this makes sense to you. I think you were getting confused because it happens to (in your case) return entries that are roughly surrounding the last entry returned by getTop(...), but that is just coincidence. The methods actually behave as documented.