How to draw a Polyline across Figure [message #64533] |
Wed, 12 February 2003 09:51  |
Eclipse User |
|
|
|
Hi,
I need to draw a line across a figure. I used polyline but I was not able to
find the location of the figure in the clientarea. I need to draw a sort of
table inside the figure where in the user can drop other figures.
Any inputs.
Thanks in advance,
Dinesh
|
|
|
|
Re: How to draw a Polyline across Figure [message #64603 is a reply to message #64580] |
Wed, 12 February 2003 23:15   |
Eclipse User |
|
|
|
Randy,
Thanks for the reply. I am drawing the line inside Figure. It doesnt have a
method drawline.
My code is
IFigure fig = new Figure();
fig.setOpaque(true);
fig.setBackgroundColor(ColorConstants.lightGray);
fig.setLayoutManager(new FreeformLayout());
Polyline line=new Polyline(); //This is the line I like to draw inside the
figure
line.setParent(fig);
Rectangle r = fig.getBounds().getCropped(fig.getInsets());
line.setEndpoints(r.getLeft(),r.getRight());
line.setForegroundColor(ColorConstants.black);
line.setLineWidth(200);
line.setFill(true);
line.setLayoutManager(new FreeformLayout());
Thanks,
Dinesh
"Randy Hudson" <none@us.ibm.com> wrote in message
news:b2dogr$11a$1@rogue.oti.com...
> Client area is the region in which children figures are placed. If you
are
> painting the actual parent figure itself, you should use it's bounds,
> cropped by its insets. Most of the time these two Rectangle will be the
> same, but if your figure uses local coordinates, they are different.
>
> protected void paintFigure(Graphics g) {
> Rectangle r = getBounds().getCropped(getInsets());
> //Draw a plus sign inside the figure.
> g.drawLine(r.getLeft(), r.getRight());
> g.drawLine(r.getTop(), r.getBottom());
> }
>
> "Dinesh Varadharajan" <dvaradharajan@selectica.com> wrote in message
> news:b2dldl$t94$1@rogue.oti.com...
> > Hi,
> > I need to draw a line across a figure. I used polyline but I was not
able
> to
> > find the location of the figure in the clientarea. I need to draw a sort
> of
> > table inside the figure where in the user can drop other figures.
> >
> > Any inputs.
> > Thanks in advance,
> > Dinesh
> >
> >
>
>
|
|
|
Working well >> Howto draw a Polyline across Figure [message #64625 is a reply to message #64603] |
Thu, 13 February 2003 00:24  |
Eclipse User |
|
|
|
Randy,
I got it working now. I override the figure class and now it is working.
Thanks,
Dinesh
"Dinesh Varadharajan" <dvaradharajan@selectica.com> wrote in message
news:b2f4gc$15d$1@rogue.oti.com...
> Randy,
> Thanks for the reply. I am drawing the line inside Figure. It doesnt have
a
> method drawline.
>
> My code is
> IFigure fig = new Figure();
>
> fig.setOpaque(true);
>
> fig.setBackgroundColor(ColorConstants.lightGray);
>
> fig.setLayoutManager(new FreeformLayout());
>
> Polyline line=new Polyline(); //This is the line I like to draw inside
the
> figure
>
> line.setParent(fig);
>
>
> Rectangle r = fig.getBounds().getCropped(fig.getInsets());
>
>
> line.setEndpoints(r.getLeft(),r.getRight());
>
> line.setForegroundColor(ColorConstants.black);
>
> line.setLineWidth(200);
>
> line.setFill(true);
>
> line.setLayoutManager(new FreeformLayout());
>
> Thanks,
> Dinesh
>
> "Randy Hudson" <none@us.ibm.com> wrote in message
> news:b2dogr$11a$1@rogue.oti.com...
> > Client area is the region in which children figures are placed. If you
> are
> > painting the actual parent figure itself, you should use it's bounds,
> > cropped by its insets. Most of the time these two Rectangle will be the
> > same, but if your figure uses local coordinates, they are different.
> >
> > protected void paintFigure(Graphics g) {
> > Rectangle r = getBounds().getCropped(getInsets());
> > //Draw a plus sign inside the figure.
> > g.drawLine(r.getLeft(), r.getRight());
> > g.drawLine(r.getTop(), r.getBottom());
> > }
> >
> > "Dinesh Varadharajan" <dvaradharajan@selectica.com> wrote in message
> > news:b2dldl$t94$1@rogue.oti.com...
> > > Hi,
> > > I need to draw a line across a figure. I used polyline but I was not
> able
> > to
> > > find the location of the figure in the clientarea. I need to draw a
sort
> > of
> > > table inside the figure where in the user can drop other figures.
> > >
> > > Any inputs.
> > > Thanks in advance,
> > > Dinesh
> > >
> > >
> >
> >
>
>
|
|
|
Powered by
FUDForum. Page generated in 0.24238 seconds