Not sure what's up with the project, but after declaring the JButton, using an if statement, I found that the value of the button was still equal to null. In the program, this is pretty much what I'm doing
for (int i = 0 ; i <array.length; i++)
{
array[i] = new JButton();
}
for (int i = 0; i<array.length; i++)
{
array[i].setText(""); //setting to whatever the value should be right here. In certain instances, we need the button to say "Character" while in others, we need the button to say "7" or the rest of the numbers.
} //end of for loop.
But even with the array[i] = newJButton();, it looks as if it did not create a new JButton. It just...I'm not even sure. It just seems to have set it to null rather than anything else.
Almost at the end of the method, I wrote "array[i].addMouseListener(this)" and according to a tracing statement in this section, the whatClicked variable worked. But the program had absolutely no idea what array[i] was talking about because it was apparently set to null.
That's a good point, actually. I should check whether the Java APIs say that buttons supports "setText()". But I mean, if it wasn't supported, NetBeans would not have offered it on their list. And it does. It says that it is supported by inheritance from the Java.Abstract Button class.
I don't even. Okay, well, I'll figure it out eventually. In the meantime, I think I'll write some pseudocode (but I really highly dislike pseudocode)..maybe a user manual. Or something like that. I have an idea of how the program is going to work anyways, so..
Well, this is what the rubric says: Includes some other form of external
documentation (manual, flowchart, project management, problems &
solutions report, pseudo-code, etc)
But saying that, I've just finished the flowchart (as in just deleting the parts that I do not need as it isn't in the console window), problems and solutions, and the blog. That should be enough....I think I'll just put up the problems and solutions right now.
No comments:
Post a Comment