This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Actually you won't ever call paint(Graphics g) yourself directly. If you want paint() to run you will call repaint(). Now this is because paint is called from a seperate thread, not a thread that you create, and can run at the JVMs choosing. So the only way to force that paint will run is to call repaint() then serviceRepaints() right after each other.
First lets, put CODE tags around the code so that we can see the formatting. And lets put those curly braces on the lines above, line them up better, and change the variable names all so that it follows the Sun Java Coding Standards. Coding standards are very very important so that everyone can read the code.
Now we can read the code without being distracted. [ July 26, 2005: Message edited by: Mark Spritzler ]
OK, you will alson eed to change the variable names like GbLeft , GbTop. All variables should start with a lower case letter, then follow the camelback format, where each new word after the first word in a variable name is capitalized.
Where are those variables defined anyway, as well as perSpace, and image?
Well, I can't tell what you are trying to do by those calculations, but my wild guess is that the result of x is so large for the second image that it is off screen.
Joined: May 18, 2005
Oh, I'm sorry. Here are my variable declarations:
public int GbLeft; // this value is 108; public int GbTop; // this value is 96; public int perSpace; // this initial value for this is 1
public Boolean checking; // Relevant indicator for assignResult to be performed public Image resultImage = new Image; // array to hold an image public int RIctr; // counter for Result Image public int TRctr;
some codes here
Mark, What I have here is a revised version of my code. I changed displayResult to assignResult wherein I assigned every image there inside the array. I called the repaint() so that every image is displayed.
The images were displayed, however, we have a new problem. After displaying the images inside the resultimage array, I received this error:
I think I have a problem with my repainting, don't you think so?
Thanks for editing my displayed code (again). I hope I got it this time.