From what I can see, these are strait lines, with their ends sliding along the edges of the drawing area, right? Just divide the width and height of the drawing area by the same amount (number of steps needed to draw the shape in one corner), and then loop, changing the angle of the line ever so slightly, until the line has been rotated by 90deg. You could wrap this loop in a method, and use it's parameters to determine which corner should be painted.
For example, if you're drawing in the top-left corner, and you're starting, say, from the vertical position, then, as the loop progresses, and as the line slides, only one coordinate at each of the ends is changing:
// Ends: (x1, y1) ------------ (x2, y2)
x1 = 0;
y2 = 0;
for (int i = 0; i < numSegments; ++i)
y1 = yMax - i * yIncrement; // move end1
x2 = i * xIncrement; // move end2
g.drawLine(x1, y1, x2, y2);
Now, instead of hard-coding x1, y2, yMax, increments etc., you can modify the code, put it in a method, and use method parameters instead. For example, if xMax and yMax are known, and if you have a predetermined number of steps, you can calculate the increments. The method can look something like this: drawWeb(int end1Start, int end1Anchor, int end2Start, int end2Anchor, Graphics g), where start-parameters mark the starting (variable) coordinate components for each end, and anchor-parameters define the edges along which the ends are going to slide.
Then you call the method 4 times with different parameters, from within paint(), passing the graphics object as well.
That's the basic idea - you can, of course, vary it and adapt it to suit your needs.
Last edited by TheGreatCthulhu; September 27th, 2012 at 07:01 PM.