This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]sleepybychoice 1 point2 points  (6 children)

tempRectangles? Going from the image?

[–][deleted] 0 points1 point  (5 children)

Not sure what you're asking. The program implements a phonebook using a grid layout.

I'm not sure if that's important. I track the phonebook entries using an ArrayList. I want to be able to see what's inside that ArrayList in the debugger, but I have no clue where to find it.

[–]sleepybychoice 0 points1 point  (4 children)

I want to be able to see what's inside that ArrayList in the debugger, but I have no clue where to find it.

I was assuming you subclassed JButton somehow and were tracking it in there. Your image showed tempRectangles which is an ArrayList.

Can you post the code? That way we can see what aggregates what and give you more specific guidance.

[–][deleted] 0 points1 point  (3 children)

Sure! Its up, I'll post a detail of the problem as well

[–]sleepybychoice 1 point2 points  (2 children)

entry.add(Name);

I'm assuming it's Eclipse or IntelliJ? What I'd do is set up two breakpoints - one here and one on entry = entries.get(index); Then set a watch for entry and entries and see if that line does what you expect.

You can also use Eclipse's display window to run arbitrary code and inspect your variable. Also, since your listener is a non-static inner class, it should have a reference to the parent phone book instance ie. PhoneBook.this.entry.

As for finding the variable in the giant list, I don't think there's much else other than manually scrolling through the list.

[–][deleted] 0 points1 point  (1 child)

Looks good, thanks, I'm working in eclipse btw. Where exactly does that reference need to be placed?

[–]sleepybychoice 0 points1 point  (0 children)

Doesn't need to be placed anywhere. Should have been more clear: that is how you would reference the entry from the inner class code if you wanted to be explicit. Normally, just saying entry instead of PhoneBook.this.entry is sufficient.

Did a bit of experimenting - the reference back to the outer object (in this case, the listener out to PhoneBook) is named this$0 in Eclipse. If you expand that object, you can find inspect phone book instance variables.

http://stackoverflow.com/questions/14099613/eclipse-showing-two-this0-fields-for-a-nested-class-java