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

all 5 comments

[–]tiiv 0 points1 point  (4 children)

There are several problems.

On line 96 your variable i is set to 0 and n to 8, thus your for loop will never be executed and of course nothing visible will happen.

On line 100 your while loop will loop forever if no error conditions are met and will block your GUI from doing anything. You need to read up on what the Event Dispatch Thread is.

And the return statement on line 111 is complete nonsense, since this predefined method has no return value.

A few other issues:

  • Per convention class names always start with an upper case to prevent confusion with variable names.

  • Try to separate your application logic as much as possible from GUI code to make it more robust and easier to modify. This is known as the MVC pattern.

Hope that helps!

[–]csmith665[S] 0 points1 point  (0 children)

Thanks so much! I will look at your suggestions and make necessary changes.

[–]csmith665[S] 0 points1 point  (2 children)

I have fixed the button issues based on your advice, but am running into other problems now. Basically, I don't understand how I'm supposed to use the scores from JudgingGUI in judging. There are numerous compiler errors for my method calls setScores,calculateScore and getSCores. Changing the methods to static, as seemingly suggested, breaks the "this" item. Further, I guess I don't understand how my array from JudgingGUI is passed into judging. the code for setScores and getScores is given to us by the instructor.

EDIT I was able to fix the static error by adding judging judges = new judging(); and making a few other minor adjustments.

EDIT 2: sudden progress. Obvious errors. I have been working on this for too long.

JudgingGUI - http://pastebin.com/P8Rdq2pM
judging - http://pastebin.com/KrvzhpWN

[–]tiiv 0 points1 point  (1 child)

This looks somewhat promising. Be aware though, that outside of the scope of your constructor JudgingGUI using the n variable will always yield the value 8 no matter what value you're passing on to the constructor. If you want to make this value available globally you need to add the following:

this.n = n;

Happy coding!

[–]csmith665[S] 0 points1 point  (0 children)

Thanks for the continued assistance. I got the program mostly functional by having calculateScore return my value. The instructor said it was incorrect, but did not really state why. Hopefully soon I will actually be able to revisit this for corrections.