Line Figure with a small circle at both end [message #161053] |
Thu, 09 December 2004 03:38 |
Eclipse User |
|
|
|
Originally posted by: jsk_lam.hotmail.com
Hi,
Can someone show me how to make the line figure which
have a small round circle at both end? See below:
o-----------------------o
Thanks
slam
|
|
|
Re: Line Figure with a small circle at both end [message #161069 is a reply to message #161053] |
Thu, 09 December 2004 09:31 |
Eclipse User |
|
|
|
Originally posted by: igor.rulim.de
slam wrote:
> Can someone show me how to make the line figure which
> have a small round circle at both end? See below:
>
> o-----------------------o
Something like this (untested!):
Polyline line = new Polyline();
Point start = new Point(50, 50);
Point end = new Point(100, 50);
line.setEndpoints(start, end);
Rectangle bounds = new Rectangle(0, 0, 10, 10);
Ellipse circle1 = new Ellipse();
start.x = start.x - (bounds.width / 2);
start.y = start.y - (bounds.height / 2);
bounds.setLocation(start);
circle1.setBounds(bounds);
Ellipse circle2 = new Ellipse();
end.x = end.x - (bounds.width / 2);
end.y = end.y - (bounds.height / 2);
bounds.setLocation(end);
circle2.setBounds(bounds);
HTH,
Igor
|
|
|
Re: Line Figure with a small circle at both end [message #161118 is a reply to message #161069] |
Thu, 09 December 2004 15:21 |
Eclipse User |
|
|
|
Originally posted by: none.us.ibm.com
You could extend ellipse and implement rotatable decoration.
"Igor Stroh" <igor@rulim.de> wrote in message
news:cp9626$fo5$1@www.eclipse.org...
> slam wrote:
>
> > Can someone show me how to make the line figure which
> > have a small round circle at both end? See below:
> >
> > o-----------------------o
>
> Something like this (untested!):
>
> Polyline line = new Polyline();
> Point start = new Point(50, 50);
> Point end = new Point(100, 50);
> line.setEndpoints(start, end);
>
> Rectangle bounds = new Rectangle(0, 0, 10, 10);
>
> Ellipse circle1 = new Ellipse();
> start.x = start.x - (bounds.width / 2);
> start.y = start.y - (bounds.height / 2);
> bounds.setLocation(start);
> circle1.setBounds(bounds);
>
> Ellipse circle2 = new Ellipse();
> end.x = end.x - (bounds.width / 2);
> end.y = end.y - (bounds.height / 2);
> bounds.setLocation(end);
> circle2.setBounds(bounds);
>
> HTH,
> Igor
|
|
|
|
Powered by
FUDForum. Page generated in 0.03668 seconds