# An applet using Timer

Moni Patil
Greenhorn
Posts: 9
Code for An applet using Timer that shows a line segment rotating about its mid-point

Ulf Dittmer
Rancher
Posts: 42968
73
And the problem you have implementing this is ... what, exactly ?

How to ask question on Javaranch

Moni Patil
Greenhorn
Posts: 9
Rephrasing the below Question

Write an applet that shows a line segment rotating about its mid-point. (Use a Thread)

Ulf Dittmer
Rancher
Posts: 42968
73
That's not a question, it's an assignment. Is it homework that you should be doing? People here are not going to do it for you, although they will help you if you get stuck somewhere along the way.

In the meantime, you could also read up on How to ask questions on JavaRanch, particularly the section on "Do your own homework".

Michael Dunn
Ranch Hand
Posts: 4632
see if I can point you in some direction.

think of a square.
each corner of the square has a point location (x,y).

can you draw diagonal lines between these points:
x,y top left to x,y lower right
x,y lower left to x,y top right

can you draw a horizontal line and a vertical line, between the corner x,y positions.

if you can do this, all you have to do is put them in the right order,

note: the horizontal/vertical lines will be slightly shorter than the diagonals,
so you may have to include an additional calculation if the assignment stipulates
the lines are to be the exact same length.
[ September 16, 2005: Message edited by: Michael Dunn ]