I know Java, but I'll admit to being rusty, having not programmed in it for a while.
I don't reckon to be much help with the math bit, but start out with the variables. You know that you have placeholders such as the current hole #, total strokes, score, et. al. Each time there's an event, you can update the placeholder by the current value(s) within the second while loop.
Each time the user hits the ball, I'm presuming that you figure out the metrics (strength, angle) by a formula or two (I'm assuming something Pythagorean theorem based), with some help from the geometry AWT package Once that's figured out, you're calling the AWT/Swing methods to draw the path of the ball. If ballInHole is true, then you're scoring the hole into the # holes played, total number of strokes, handicap and emptying out # strokes, as well assuming that for the next hole someone hits a hole in one (in other words, you have a negative number starting from the hole, such that for each additional stroke, you're incrementing up). Assuming there's an array of holes which tell you the par and the number of feet away from tee shot, then it should be straightforward to keep score. If false, well, then you carry on. You're adding one more stroke to the stroke count for the hole and taking into account the number of feet away from the cup.
Not sure if I've got the whole picture here, but basically that would be one way to approach the problem. Good luck.