Problem: Pressing the button wasn't doing anything - even though mouseListener was activated.
Solution: When creating the button, I was editing a copy of the array rather than the real array. FAIL, right?!
Problem: I was trying to make the program so that if the user does not enter a value in the frame that pops up, a JOptionPane would pop up and ask for a value. But no matter what happened, the program would not enter the if statement.
Solution: I hadn't realized that if I declared the button up at the top of the method, that it would reset every time.
Problem: Having a variable called whichQuestion was declared at the beginning of the method to determine what answer to check for. But while testing with if statements, I found that it kept resetting itself to zero.
Solution: Also the same as the last; having been declared at the top of the mouseClicked method, it was reset to 0 every time. I just hadn't realized that the program was calling the method that it was in. I thought it would have gone through the if statements and realized that the one was true.
Problem: At the top, I want the program to update every time the score updates, but the store is in an uneditable JTextField so I'm not quite sure how to update it.
Solution: According to the APIs, the JLabel class has a "setText()" method. At the end of the 'continue' if statement, just put a "nameOfLabel.setText("Your current score is: +score+ ".');
Problem: I tried to show that I knew classes, but I guess I don't. I always thought protected was used when you wanted only the classes in that package to have access to the variable, but it gives an error when I put "protected" beside it.
Problem: The icons are much too large - I need to find a way to make them smaller, but the setSize method isn't working.
Solution: The only solution is to decrease the size of each one individually.
Problem: One of the questions - after answering it correctly, kept displaying the JOptionPane...like BOOM BOOM BOOM BOOM right after clicking ok each time.
Solution: I had to make the answerable variable false; and I did it for the wrong object variable (that's the problem with having too many objects and too many variables! It's so confuzzling).
Problem: The icons from beedle the bard are all getting cut off.
Solution: Re-screenshot it.
Problem: No matter what the program did, it was ALWAYS adding the score plus the variable sent to it.
Solution: The highScore method used += rather than =.
Problem: When I closed the Jeopardy, the program would "crash" without entirely dying.
Solution: According to the Java APIs, I should have used a "showMessageDialog" rather than a "showInternalMessageDialog" because showInternalMessageDialog is only used for components which don't have a parent component that's null.
No comments:
Post a Comment