Java GUI help
I have numerous classes, one which extends JFrame, another extends JComponent, a viewer class, a class for generating random numbers, a shape class and my main class.
-the class with JComponent has an overridden paintComponent method, which paints shapes from shape class depending on the random number generated from the other class, so if ran number = 1, it will print out 1 dot.
Each time I click a button in my main class, I want it to generate a new random number and draw a new image depending on the random number. all the action listener for the button does is update the label and call repaint.
Each time I click the button, the Jlabel prints out the random number of the image before the one that's currently on screen.
Program starts > empty label but image drawn with 2 dots > *click* label = 2 - diff image printed.
Is there any way i can put them in sync with each other?
I'm really sorry if this is too vague, but I don't want to paste code to avoid plagiarism by others.
If this question structure was dumb and too vague, I may come back and rephrase or delete, thanks.