public class Repainter extends Thread
{
public void run()
{
while (true)
{
repaint();
try
{
Type: Posts; User: Toldry
public class Repainter extends Thread
{
public void run()
{
while (true)
{
repaint();
try
{
I managed to find how to make rainbow colors from
Create a rainbow with GD
But now I have two new problems (because of the exception I posted above)
1. My repainter thread doesn't work
2. I...
I used your method and now I'm getting "java.lang.IllegalMonitorStateException"
Unrelated problem:
Assuming I have a variable that goes from 0 to 1, how do I use it and the class Color to get a rainbow spectrum? (0=red, 1=violet)
Here:
import java.util.logging.Level;
import java.util.logging.Logger;
public class ThreadProblem
{
Here's my project
https://dl.dropbox.com/u/73680434/Simple%20Graphics.rar
These are the relevant functions
public MyCanvas()
{
setSize(width, height);
setVisible(true);
ren.setWindow(-2.2,1.3,3.4,2.6);
...
Right... never mind, I managed to solve my problem.
But I have a new one now regarding threads; I'm trying to activate two threads at the same time, one that repaints every half second and another...
I put a line in the start of the function paint()
System.out.println("Painting");
(not in the version I posted above)
and it prints that three times
edit: three times, not twice
My question is why my code calls the paint() function multiple times
Then it's in a GUI class because I can see it on my screen. (which is the entire point of this program)
How does the JVM determine when the GUI needs to be drawn?
For some reason the paint()...
I might as well post all the code I have so far
package Mendelbrot;
import java.awt.*;
import java.util.logging.Level;
import java.util.logging.Logger;
I'm fresh out of highschool in terms of my java knowledge, so I don't know much yet
In your post I don't know what these terms are:
GUI class
JVM
Java SE
swing class
Basically, to familiarize myself with this class I'm doing my first project, which is drawing the Mendelbrot Set, but before that I have to handle much simpler things;
If I have a the class ...