Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » Line Figure with a small circle at both end
Line Figure with a small circle at both end [message #161053] Thu, 09 December 2004 03:38 Go to next message
Eclipse UserFriend
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 Go to previous messageGo to next message
Eclipse UserFriend
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 Go to previous messageGo to next message
Eclipse UserFriend
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
Re: Line Figure with a small circle at both end [message #161179 is a reply to message #161118] Fri, 10 December 2004 06:00 Go to previous message
Barry Lay is currently offline Barry LayFriend
Messages: 48
Registered: July 2009
Member
I would be interested if anyone has done this. I ended up creating a
PolygonDecoration with eight points: it looks good enough if it is
small. An proper circle could take advantage of the fact that the
figure itself doesn't have to be rotated.

My problem is that I just haven't waded through enough of the draw2d
code to figure out how the ends of the Polyline are rendered so that I
can do what is suggested.

Thanks,
Barry

Randy Hudson wrote:
> You could extend ellipse and implement rotatable decoration.
>
Previous Topic:How to be notified when layout is done
Next Topic:Can a figure be resized automatically ?
Goto Forum:
  


Current Time: Wed Apr 24 21:20:11 GMT 2024

Powered by FUDForum. Page generated in 0.03668 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top