Paul Clapham wrote:Well, there's a lot of code there. And all we know is that somewhere in that code, you have a null value appearing somehow and you don't think that should be happening. So could you be a little bit more specific about just where in that code you see the null value appearing?
Paul Clapham wrote:But you don't even have any code there (in the first fragment) which tries to get data out of the nodes you created in the second fragment.
So is that your question? What code you should write to get data?
If you have a ProbNode object, then you just call its getName() method to get the string which was stored in the node. Are you asking how to get one of those? My guess would be that you have a ProbMgr object handy somewhere, and you can get the nodes from that. But that's just a guess, though. I don't know what this list is for or why you are using it. If it were me I would just read the text file and generate the buttons from that, rather than mess about with an intermediate step where you stash the data somewhere and then read it back.
Logan Wilson wrote:I'm lost trying to figure out how to place the String value in the JButton. Eclipse keeps warning me I have invalid type comparing them if I try to directly place the Node.name element, or even the Node.name.toString(), in there. I've tried multiple ways to fit a square peg into a round hole.
My question is: Is there a way to directly place those elements into the JButton, or should I assign my link list node Strings into an array, and then just repopulate the buttons with the array?
Paul Clapham wrote:
What elements? My problem here is that I don't know what you mean by an "element".
My guess is that all you have to do is to get a String out of your list and assign it to the JButton using its setText() method, but the whole thing seems like an excessively complicated way of doing something which should be quite simple.
Paul Clapham wrote:Okay. I'm looking at that readList() method. Apparently that's supposed to be there for the purpose of reading from a text file and adding the lines from it into a list. As I already said, if it were me I would just skip the whole list business and create the JButtons right there. But at any rate that's all moot because you aren't actually calling that method anywhere.