Hi all,
I am struggling ( ! ) with java GUI development. All these small things that make obvious sense just don't work. I'll explain what I am trying to do and where I am failing (this is quite frustrating):
I've got this graphics2d object which resides inside a panel. Now this graphics draws an image, it can go on and draw forever. this drawing expands horrioncally and since I do not know what size to expect I put it inside a scrollpane. Now I want to resize the JPanel in each pain iteration and set the setPreferredSize to a larger value, thus expanding the scrollpane's knob.
The problem: From some reason when I call setPreferredSize from paint it doesn't do anything. I call it on the panel. When I try calling setPreferredSize from the function that calls paint, it performs the resizing operation only once!
What could be the reason for that?
Apart from that I've got another small question, I'd love to solve: Since the graphics draw goes on and increases in size in time, how can I advance the position of scrollpanes? Gradually increasing it?
People, thank you very much. I sure need help here