Campbell Ritchie wrote:Welcome to the Ranch
Brandon Buchanan wrote: . . . guess we can close this one.
Thanks.
No, you can’t. Several things can be improved. Your code formatting is inconsistent, not helped by your using tab characters; you ought to use spaces for indenting. Your lines are so long they are difficult to read. I have edited your post by splitting the longest lines.
Why have you got the three panels with a single Component in a Grid Layout? Why don’t you use one panel with a three-component Grid Layout?
I presume you used the setText() method of the text field to set its output. You may find the String#format method better than DecimalFormat. It is similar to printf, but creates a String object.
Haha! I knew someone would probably chime in with how bad my code is... sorry. I am new to
java programming and I don't yet have it all figured out, obviously!
So, let's take your response and piece it out.
1. Code formatting inconsistent, and using tab characters --- I didn't know that it wasn't kosher to use tab characters? Is there a reason why this is bad? Also, thank you for editing the lines, I never knew how long is too long?
2.The 3 panels with the single component in a GridLayout --- I was just copying and pasting as I was going and I didn't realize that this could be set up differently? Do you have an example of how I can use one panel with a three-component GridLayout?
3. Are you talking about the setText() on line 165? I didn't know that this could be done differently either? Also, I am not familiar with the "String#format" and I have only ever used the decimalformat in my past assignments.
I am glad that you responded, I would love to learn how to become a better coder, and these kinds of things really do help! For now, my new assignment is working exactly as I need it to, but it's different than what was posted here because what's posted here was previously not working. However, if you wouldn't mind coaching me through some of the "issues" with my code, I will make the changes in my final version of the assignment and then repost for your review?
Thanks so much!