Hello,
I am having a difficulty in passing a barrier of JAVA graphics generating. I hope you could explain some things to me, cause I have noone to help me and it is hard to get help in internet, because I feel like missing something important.
The thing is I cannot find an example of JAVA application which looks like similar to the one I am showing a picture to you.
This is what I already managed to do and I was really happy about it. The problematic thing is, I am totally stuck with making it work in a beautiful way, which I want to be: being able to make a user of the program see step-by-step line drawing (once he clicks a button after placing points, the program should paint each line every half a second or so). That would be a demonstration of the algorithms used. Now the only thing I could do was just to painting all lines at once just after the button is clicked. I am trying to put a Thread.sleep(500) in a lines drawing loop, but it just ignores that and runs to the result. I also try to add that sleep in an algorithm and repaint() everything all the time, but it still skips all my efforts and I cannot do anything.
I put a component Graphic(my written class) called G in my Main class. That Graphic has paint() method which paints all the points and lines. On PW(stands for package wrapping) button clicked I get the result of Lines I need to draw. Here is how it looks:
if (arg0.getSource() == pw)
{
PackageWrapping PW = new PackageWrapping(G);
Vector<Line>BE = PW.lines(POINTS);
G.transfer(POINTS, BE);
G.repaint();
}
I do not have anyone to turn to, who could give me a working example, explain my mistakes or just give any good advice.
I really expect you could help me. If you need any deeper information related to my code, just let me know.