Home » Eclipse Projects » GEF » Bug in Polygon/PointList?
Bug in Polygon/PointList? [message #117270] |
Thu, 12 February 2004 04:15  |
Eclipse User |
|
|
|
I just noticed a very odd behaviour when I created a semicircle using a
polygon (anyone got any better ideas of how to do this btw?).
If I construct a PointList so:
PointList points = new PointList(20);
It creates an empty int[40], right?
If I use addPoint(x,y), to fill the PointList then there are no problems
when I use Polygon.setPoints(PointList).
If, the points have already been added with addPoint(x,y) and then I
change them with setPoint(Point, int), again no problems.
However, if I just use setPoint(Point, int) although the PointList seems
to form correctly when I look at it in the debugger, when it comes to
being assigned to a Polygon it has mysteriously reverted to being empty.
private static final PointList getSEMICIRCLE() {
int radius = 10;
PointList points = new PointList(2*radius);
for (int i=0; i<2*radius; i++) { //XXX doesn't work without this loop
points.addPoint(0,0); //initialise Points
}
points.setPoint(new Point(0,radius), 0);
points.setPoint(new Point(radius, 0), radius);
points.setPoint(new Point(2*radius,radius), 2*radius-1);
for (int i=1; i<radius; i++) {
double y = Math.round(Math.sqrt(radius*radius - i*i));
points.setPoint(new Point(radius-i, 10-y), radius-i);
points.setPoint(new Point(radius+i, 10-y), radius+i-1);
}
return points;
}
I don't think this is my code as all I changed was add/setPoint to correct
the issue. I'm using Solaris SPARC, motif, Eclipse 3.0M3, GEF 2.1.1.
Thanks for your help
Chris Heald
EADS
|
|
|
Re: Bug in Polygon/PointList? [message #117323 is a reply to message #117270] |
Thu, 12 February 2004 09:34   |
Eclipse User |
|
|
|
Originally posted by: none.us.ibm.com
When you create a PointList with a given size, it gives it that capacity -
but does not set the internal size value to that number. It waits until
actual points are added before modifying its size variable. SetPoint javadoc
says "Overwrites a point at a given index in the list", whereas addPoint
"Adds Point p to this PointList". Since the point doesn't yet exist, the
size variable isn't being updated in setPoint. I would continue to use
addPoint, call setSize(2*radius) on the PointList, or consider drawing the
semicircle with a call to drawArc. Also there is new API in GEF 3.0 builds
that allows the use of a drawPolygon(int[]) method from Graphics, if you
decide to update sometime soon.
"Chris Heald" <chris.heald@m.eads.net> wrote in message
news:c0fg87$tlp$1@eclipse.org...
> I just noticed a very odd behaviour when I created a semicircle using a
> polygon (anyone got any better ideas of how to do this btw?).
> If I construct a PointList so:
> PointList points = new PointList(20);
> It creates an empty int[40], right?
> If I use addPoint(x,y), to fill the PointList then there are no problems
> when I use Polygon.setPoints(PointList).
>
> If, the points have already been added with addPoint(x,y) and then I
> change them with setPoint(Point, int), again no problems.
>
> However, if I just use setPoint(Point, int) although the PointList seems
> to form correctly when I look at it in the debugger, when it comes to
> being assigned to a Polygon it has mysteriously reverted to being empty.
>
> private static final PointList getSEMICIRCLE() {
> int radius = 10;
> PointList points = new PointList(2*radius);
> for (int i=0; i<2*radius; i++) { //XXX doesn't work without this
loop
> points.addPoint(0,0); //initialise Points
> }
> points.setPoint(new Point(0,radius), 0);
> points.setPoint(new Point(radius, 0), radius);
> points.setPoint(new Point(2*radius,radius), 2*radius-1);
> for (int i=1; i<radius; i++) {
> double y = Math.round(Math.sqrt(radius*radius - i*i));
> points.setPoint(new Point(radius-i, 10-y), radius-i);
> points.setPoint(new Point(radius+i, 10-y), radius+i-1);
> }
> return points;
> }
>
>
> I don't think this is my code as all I changed was add/setPoint to correct
> the issue. I'm using Solaris SPARC, motif, Eclipse 3.0M3, GEF 2.1.1.
>
> Thanks for your help
> Chris Heald
> EADS
>
>
>
|
|
|
Re: Bug in Polygon/PointList? [message #117363 is a reply to message #117323] |
Thu, 12 February 2004 12:01   |
Eclipse User |
|
|
|
Aha!
Thanks for the info. I'm always ready to update but as for the rest of my
team...you know how it is. I believe the current plan is to wait for the
full release of Eclipse/GEF 3.0.
When you say drawArc, do you mean Graphics.drawArc()?
Thanks again
Chris Heald
EADS
Whitney Sorenson wrote:
> When you create a PointList with a given size, it gives it that capacity -
> but does not set the internal size value to that number. It waits until
> actual points are added before modifying its size variable. SetPoint javadoc
> says "Overwrites a point at a given index in the list", whereas addPoint
> "Adds Point p to this PointList". Since the point doesn't yet exist, the
> size variable isn't being updated in setPoint. I would continue to use
> addPoint, call setSize(2*radius) on the PointList, or consider drawing the
> semicircle with a call to drawArc. Also there is new API in GEF 3.0 builds
> that allows the use of a drawPolygon(int[]) method from Graphics, if you
> decide to update sometime soon.
> "Chris Heald" <chris.heald@m.eads.net> wrote in message
> news:c0fg87$tlp$1@eclipse.org...
> > I just noticed a very odd behaviour when I created a semicircle using a
> > polygon (anyone got any better ideas of how to do this btw?).
> > If I construct a PointList so:
> > PointList points = new PointList(20);
> > It creates an empty int[40], right?
> > If I use addPoint(x,y), to fill the PointList then there are no problems
> > when I use Polygon.setPoints(PointList).
> >
> > If, the points have already been added with addPoint(x,y) and then I
> > change them with setPoint(Point, int), again no problems.
> >
> > However, if I just use setPoint(Point, int) although the PointList seems
> > to form correctly when I look at it in the debugger, when it comes to
> > being assigned to a Polygon it has mysteriously reverted to being empty.
> >
> > private static final PointList getSEMICIRCLE() {
> > int radius = 10;
> > PointList points = new PointList(2*radius);
> > for (int i=0; i<2*radius; i++) { //XXX doesn't work without this
> loop
> > points.addPoint(0,0); //initialise Points
> > }
> > points.setPoint(new Point(0,radius), 0);
> > points.setPoint(new Point(radius, 0), radius);
> > points.setPoint(new Point(2*radius,radius), 2*radius-1);
> > for (int i=1; i<radius; i++) {
> > double y = Math.round(Math.sqrt(radius*radius - i*i));
> > points.setPoint(new Point(radius-i, 10-y), radius-i);
> > points.setPoint(new Point(radius+i, 10-y), radius+i-1);
> > }
> > return points;
> > }
> >
> >
> > I don't think this is my code as all I changed was add/setPoint to correct
> > the issue. I'm using Solaris SPARC, motif, Eclipse 3.0M3, GEF 2.1.1.
> >
> > Thanks for your help
> > Chris Heald
> > EADS
> >
> >
> >
|
|
| |
Re: Bug in Polygon/PointList? [message #117785 is a reply to message #117477] |
Mon, 16 February 2004 09:54   |
Eclipse User |
|
|
|
OK, I've written a new subclass of Shape called SemiCircle.
It was almost identical to Ellipse. Seems to work perfectly until you use
the ScaleableFreeform functions to zoom. Then it just disappears...
Then I added Orientable implementations. If the arc is not a simple 0-180
affair (NORTH direction), it still works when zoomed...
I tried this with Solaris motif and Linux GTK on Eclipse 3.0M3, GEF 2.1.1
Also, I can't get the straight line to go in the right place if its meant
to go from bottom-left to top-right. Using the shrunken rectangle from the
Ellipse outlineShape puts the line inside the filled area. But for the
other diagonal it works perfectly...
BTW: Shouldn't setPoint in PointList throw an exception or something if
the index > size
Thanks for the help
/*
* Created on Feb 16, 2004
*/
package net.eads.iflow.model.figures;
import org.eclipse.draw2d.Graphics;
import org.eclipse.draw2d.Orientable;
import org.eclipse.draw2d.Shape;
import org.eclipse.draw2d.geometry.Rectangle;
/**
* @author hel
*/
public class SemiCircle extends Shape implements Orientable{
private int direction;
//Convenience constant NB sin45 == cos45
private static final double SIN45 = Math.sin(Math.PI/4);
/**
* Constructs the top half of a circle
*/
public SemiCircle() {
super();
direction = Orientable.NORTH;
}
/**
* Possible values are NORTH, SOUTH, EAST, WEST, NORTH_EAST,
NORTH_WEST, SOUTH_EAST, SOUTH_WEST
* To create the top. bottom, right-hand. left-hand etc half of a circle
* @param orientation
*/
public SemiCircle(int direction) {
super();
this.direction = direction;
}
/* (non-Javadoc)
* @see org.eclipse.draw2d.Shape#fillShape(org.eclipse.draw2d.Graphi cs)
*/
protected void fillShape(Graphics graphics) {
switch (direction) {
case Orientable.NORTH : graphics.fillArc(getBounds(), 0, 180);
break;//FIXME : doesn't show in zoom
case Orientable.SOUTH : graphics.fillArc(getBounds(), 0, -180);
break;
case Orientable.EAST : graphics.fillArc(getBounds(), 90, -180);
break;
case Orientable.WEST : graphics.fillArc(getBounds(), 90, 180);
break;
case Orientable.SOUTH_EAST : graphics.fillArc(getBounds(), 45,
-180); break;
case Orientable.SOUTH_WEST : graphics.fillArc(getBounds(), 135,
180); break;
case Orientable.NORTH_EAST : graphics.fillArc(getBounds(), 135,
-180); break;
case Orientable.NORTH_WEST : graphics.fillArc(getBounds(), 45,
180); break;
}
}
/* (non-Javadoc)
* @see org.eclipse.draw2d.Shape#outlineShape(org.eclipse.draw2d.Gra phics)
*/
protected void outlineShape(Graphics graphics) {
Rectangle r = Rectangle.SINGLETON;
r.setBounds(getBounds());
r.width--;
r.height--;
r.shrink((lineWidth - 1) / 2, (lineWidth - 1) / 2);
switch (direction) {
case Orientable.NORTH :
graphics.drawArc(r, 0, 180);
graphics.drawLine(
r.x,
r.y + r.height / 2,
r.x + r.width,
r.y + r.height / 2);
break;
case Orientable.SOUTH :
graphics.drawArc(r, 0, -180);
graphics.drawLine(
r.x,
r.y + r.height / 2,
r.x + r.width,
r.y + r.height / 2);
break;
case Orientable.EAST :
graphics.drawArc(r, 90, -180);
graphics.drawLine(
r.x + r.width / 2,
r.y,
r.x + r.width / 2,
r.y + r.height);
break;
case Orientable.WEST :
graphics.drawArc(r, 90, 180);
graphics.drawLine(
r.x + r.width / 2,
r.y,
r.x + r.width / 2,
r.y + r.height);
break;
//TODO fix position of diagonal lines in SE, NW
case Orientable.SOUTH_EAST : {
graphics.drawArc(r, 45, -180);
int radius = Math.min(r.width, r.height)/2;
double d = SIN45*radius;
graphics.drawLine(
(int) Math.round(r.width / 2 - d),
(int) Math.round(r.height / 2 + d),
(int) Math.round(r.width / 2 + d),
(int) Math.round(r.height / 2 - d));
break;
}
case Orientable.SOUTH_WEST : {
graphics.drawArc(r, 135, 180);
int radius = Math.min(r.width, r.height)/2;
double d = SIN45*radius;
graphics.drawLine(
(int) Math.round(r.width / 2 - d),
(int) Math.round(r.height / 2 - d),
(int) Math.round(r.width / 2 + d),
(int) Math.round(r.height / 2 + d));
break;
}
case Orientable.NORTH_EAST : {
graphics.drawArc(r, 135, -180);
int radius = Math.min(r.width, r.height)/2;
double d = SIN45*radius;
graphics.drawLine(
(int) Math.round(r.width / 2 - d),
(int) Math.round(r.height / 2 - d),
(int) Math.round(r.width / 2 + d),
(int) Math.round(r.height / 2 + d));
break;
}
case Orientable.NORTH_WEST : {
graphics.drawArc(r, 45, 180);
int radius = Math.min(r.width, r.height)/2;
double d = SIN45*radius;
graphics.drawLine(
(int) Math.round(r.width / 2 - d),
(int) Math.round(r.height / 2 + d),
(int) Math.round(r.width / 2 + d),
(int) Math.round(r.height / 2 - d));
break;
}
}
}
/* (non-Javadoc)
* @see org.eclipse.draw2d.IFigure#containsPoint(int, int)
*/
public boolean containsPoint(int x, int y) {
if (!super.containsPoint(x, y)) //if outside bounds
return false;
//check if in circle
//TODO constrain to just filled area
int radius = getBounds().width;
if (y*y<=radius*radius - x*x)
return true;
else return false;
}
/**
* @throws UnsupportedOperationException:
* Use setDirection()
*/
public void setOrientation(int orientation) {
throw new UnsupportedOperationException("Use setDirection()");
}
/* (non-Javadoc)
* @see org.eclipse.draw2d.Orientable#setDirection(int)
*/
public void setDirection(int direction) {
this.direction = direction;
revalidate();
repaint();
}
}
Whitney Sorenson wrote:
> "Chris Heald" <chris.heald@m.eads.net> wrote in message
> news:c0gbhr$38l$1@eclipse.org...
> > Aha!
> > Thanks for the info. I'm always ready to update but as for the rest of my
> > team...you know how it is. I believe the current plan is to wait for the
> > full release of Eclipse/GEF 3.0.
> > When you say drawArc, do you mean Graphics.drawArc()?
> Yup.
|
|
|
problems with drawArc [message #118199 is a reply to message #117477] |
Wed, 18 February 2004 02:44   |
Eclipse User |
|
|
|
OK, I've written a new subclass of Shape called SemiCircle.
It was almost identical to Ellipse. Seems to work perfectly until you use
the ScaleableFreeform functions to zoom. Then it just disappears...
Then I added Orientable implementations. If the arc is not a simple 0-180
affair (NORTH or SOUTH direction), it still works when zoomed...
I tried this with Solaris motif and Linux GTK on Eclipse 3.0M3, GEF 2.1.1
Also, I can't get the straight line to go in the right place if its meant
to go from bottom-left to top-right. Using the shrunken rectangle from the
Ellipse outlineShape puts the line inside the filled area. But for the
other diagonal it works perfectly...
BTW: Shouldn't setPoint in PointList throw an exception or something if
the index > size
Thanks for the help
/*
* Created on Feb 16, 2004
*/
package net.eads.iflow.model.figures;
import org.eclipse.draw2d.Graphics;
import org.eclipse.draw2d.Orientable;
import org.eclipse.draw2d.Shape;
import org.eclipse.draw2d.geometry.Rectangle;
/**
* @author hel
*/
public class SemiCircle extends Shape implements Orientable{
private int direction;
//Convenience constant NB sin45 == cos45
private static final double SIN45 = Math.sin(Math.PI/4);
/**
* Constructs the top half of a circle
*/
public SemiCircle() {
super();
direction = Orientable.NORTH;
}
/**
* Possible values are NORTH, SOUTH, EAST, WEST, NORTH_EAST,
NORTH_WEST, SOUTH_EAST, SOUTH_WEST
* To create the top. bottom, right-hand. left-hand etc half of a circle
* @param orientation
*/
public SemiCircle(int direction) {
super();
this.direction = direction;
}
/* (non-Javadoc)
* @see org.eclipse.draw2d.Shape#fillShape(org.eclipse.draw2d.Graphi cs)
*/
protected void fillShape(Graphics graphics) {
switch (direction) {
case Orientable.NORTH : graphics.fillArc(getBounds(), 0, 180);
break;//FIXME : doesn't show in zoom
case Orientable.SOUTH : graphics.fillArc(getBounds(), 0, -180);
break;
case Orientable.EAST : graphics.fillArc(getBounds(), 90, -180);
break;
case Orientable.WEST : graphics.fillArc(getBounds(), 90, 180);
break;
case Orientable.SOUTH_EAST : graphics.fillArc(getBounds(), 45,
-180); break;
case Orientable.SOUTH_WEST : graphics.fillArc(getBounds(), 135,
180); break;
case Orientable.NORTH_EAST : graphics.fillArc(getBounds(), 135,
-180); break;
case Orientable.NORTH_WEST : graphics.fillArc(getBounds(), 45,
180); break;
}
}
/* (non-Javadoc)
* @see org.eclipse.draw2d.Shape#outlineShape(org.eclipse.draw2d.Gra phics)
*/
protected void outlineShape(Graphics graphics) {
Rectangle r = Rectangle.SINGLETON;
r.setBounds(getBounds());
r.width--;
r.height--;
r.shrink((lineWidth - 1) / 2, (lineWidth - 1) / 2);
switch (direction) {
case Orientable.NORTH :
graphics.drawArc(r, 0, 180);
graphics.drawLine(
r.x,
r.y + r.height / 2,
r.x + r.width,
r.y + r.height / 2);
break;
case Orientable.SOUTH :
graphics.drawArc(r, 0, -180);
graphics.drawLine(
r.x,
r.y + r.height / 2,
r.x + r.width,
r.y + r.height / 2);
break;
case Orientable.EAST :
graphics.drawArc(r, 90, -180);
graphics.drawLine(
r.x + r.width / 2,
r.y,
r.x + r.width / 2,
r.y + r.height);
break;
case Orientable.WEST :
graphics.drawArc(r, 90, 180);
graphics.drawLine(
r.x + r.width / 2,
r.y,
r.x + r.width / 2,
r.y + r.height);
break;
//TODO fix position of diagonal lines in SE, NW
case Orientable.SOUTH_EAST : {
graphics.drawArc(r, 45, -180);
int radius = Math.min(r.width, r.height)/2;
double d = SIN45*radius;
graphics.drawLine(
(int) Math.round(r.width / 2 - d),
(int) Math.round(r.height / 2 + d),
(int) Math.round(r.width / 2 + d),
(int) Math.round(r.height / 2 - d));
break;
}
case Orientable.SOUTH_WEST : {
graphics.drawArc(r, 135, 180);
int radius = Math.min(r.width, r.height)/2;
double d = SIN45*radius;
graphics.drawLine(
(int) Math.round(r.width / 2 - d),
(int) Math.round(r.height / 2 - d),
(int) Math.round(r.width / 2 + d),
(int) Math.round(r.height / 2 + d));
break;
}
case Orientable.NORTH_EAST : {
graphics.drawArc(r, 135, -180);
int radius = Math.min(r.width, r.height)/2;
double d = SIN45*radius;
graphics.drawLine(
(int) Math.round(r.width / 2 - d),
(int) Math.round(r.height / 2 - d),
(int) Math.round(r.width / 2 + d),
(int) Math.round(r.height / 2 + d));
break;
}
case Orientable.NORTH_WEST : {
graphics.drawArc(r, 45, 180);
int radius = Math.min(r.width, r.height)/2;
double d = SIN45*radius;
graphics.drawLine(
(int) Math.round(r.width / 2 - d),
(int) Math.round(r.height / 2 + d),
(int) Math.round(r.width / 2 + d),
(int) Math.round(r.height / 2 - d));
break;
}
}
}
/* (non-Javadoc)
* @see org.eclipse.draw2d.IFigure#containsPoint(int, int)
*/
public boolean containsPoint(int x, int y) {
if (!super.containsPoint(x, y)) //if outside bounds
return false;
//check if in circle
//TODO constrain to just filled area
int radius = getBounds().width;
if (y*y<=radius*radius - x*x)
return true;
else return false;
}
/**
* @throws UnsupportedOperationException:
* Use setDirection()
*/
public void setOrientation(int orientation) {
throw new UnsupportedOperationException("Use setDirection()");
}
/* (non-Javadoc)
* @see org.eclipse.draw2d.Orientable#setDirection(int)
*/
public void setDirection(int direction) {
this.direction = direction;
revalidate();
repaint();
}
}
Whitney Sorenson wrote:
> "Chris Heald" <chris.heald@m.eads.net> wrote in message
> news:c0gbhr$38l$1@eclipse.org...
> > Aha!
> > Thanks for the info. I'm always ready to update but as for the rest of my
> > team...you know how it is. I believe the current plan is to wait for the
> > full release of Eclipse/GEF 3.0.
> > When you say drawArc, do you mean Graphics.drawArc()?
> Yup.
|
|
| |
Re: problems with drawArc [message #118405 is a reply to message #118384] |
Thu, 19 February 2004 03:44   |
Eclipse User |
|
|
|
Right, will do.
Thanks for fixing it. If I want to use the fixed version, until 2.1.3 is
(fixed and) released which version would you recommend downloading? Do I
also need to update Eclipse to the latest Milestone for this?
Thanks for all your hard work
Chris
Randy Hudson wrote:
> Thanks for tracking this down. For quicker resolution next time, here is the
> preferred way of posting this problem:
> public static void main(String[] args) {
> Shell shell = new Shell();
> shell.setSize(400, 400);
> shell.setLayout(new FillLayout());
> FigureCanvas canvas = new FigureCanvas(shell);
> canvas.setContents(new Figure() {
> public void paint(Graphics g) {
> ScaledGraphics sg = new ScaledGraphics(g);
> sg.scale(2.2);
> sg.setBackgroundColor(ColorConstants.blue);
> sg.fillArc(0, 0, 50, 50, 0, 180);
> sg.dispose();
> }
> });
> shell.open();
> Display display = Display.getDefault();
> while(!shell.isDisposed())
> if (!display.readAndDispatch())
> display.sleep();
> display.dispose();
> }
> Or even better, show us the bogus code and the fix :-)
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=52414
|
|
|
Re: problems with drawArc [message #118445 is a reply to message #118405] |
Thu, 19 February 2004 10:28   |
Eclipse User |
|
|
|
Originally posted by: none.us.ibm.com
If you are wanting to use the latest version that would have this fix,
you'll probably have to get it from CVS (see the FAQ for the info). Also,
the most recent builds of GEF are targeted for Eclipse 3.0, the latest,
specifically the M7 milestone.
"Chris Heald" <chris.heald@m.eads.net> wrote in message
news:c11t0g$3r8$1@eclipse.org...
> Right, will do.
> Thanks for fixing it. If I want to use the fixed version, until 2.1.3 is
> (fixed and) released which version would you recommend downloading? Do I
> also need to update Eclipse to the latest Milestone for this?
>
> Thanks for all your hard work
> Chris
>
> Randy Hudson wrote:
>
> > Thanks for tracking this down. For quicker resolution next time, here is
the
> > preferred way of posting this problem:
>
> > public static void main(String[] args) {
> > Shell shell = new Shell();
> > shell.setSize(400, 400);
> > shell.setLayout(new FillLayout());
>
> > FigureCanvas canvas = new FigureCanvas(shell);
> > canvas.setContents(new Figure() {
> > public void paint(Graphics g) {
> > ScaledGraphics sg = new ScaledGraphics(g);
> > sg.scale(2.2);
> > sg.setBackgroundColor(ColorConstants.blue);
> > sg.fillArc(0, 0, 50, 50, 0, 180);
> > sg.dispose();
> > }
> > });
>
> > shell.open();
>
> > Display display = Display.getDefault();
> > while(!shell.isDisposed())
> > if (!display.readAndDispatch())
> > display.sleep();
> > display.dispose();
> > }
>
> > Or even better, show us the bogus code and the fix :-)
> > https://bugs.eclipse.org/bugs/show_bug.cgi?id=52414
>
>
|
|
|
Re: problems with drawArc [message #119043 is a reply to message #118405] |
Mon, 23 February 2004 11:42  |
Eclipse User |
|
|
|
Originally posted by: none.us.ibm.com
There is a workaround if you are using 2.1.x. Draw clockwise. Instead of:
sg.fillArc(0, 0, 50, 50, 0, 180);
use:
sg.fillArc(0, 0, 50, 50, 180, -180);
"Chris Heald" <chris.heald@m.eads.net> wrote in message
news:c11t0g$3r8$1@eclipse.org...
> Right, will do.
> Thanks for fixing it. If I want to use the fixed version, until 2.1.3 is
> (fixed and) released which version would you recommend downloading? Do I
> also need to update Eclipse to the latest Milestone for this?
>
> Thanks for all your hard work
> Chris
>
> Randy Hudson wrote:
>
> > Thanks for tracking this down. For quicker resolution next time, here is
the
> > preferred way of posting this problem:
>
> > public static void main(String[] args) {
> > Shell shell = new Shell();
> > shell.setSize(400, 400);
> > shell.setLayout(new FillLayout());
>
> > FigureCanvas canvas = new FigureCanvas(shell);
> > canvas.setContents(new Figure() {
> > public void paint(Graphics g) {
> > ScaledGraphics sg = new ScaledGraphics(g);
> > sg.scale(2.2);
> > sg.setBackgroundColor(ColorConstants.blue);
> > sg.fillArc(0, 0, 50, 50, 0, 180);
> > sg.dispose();
> > }
> > });
>
> > shell.open();
>
> > Display display = Display.getDefault();
> > while(!shell.isDisposed())
> > if (!display.readAndDispatch())
> > display.sleep();
> > display.dispose();
> > }
>
> > Or even better, show us the bogus code and the fix :-)
> > https://bugs.eclipse.org/bugs/show_bug.cgi?id=52414
>
>
|
|
|
Goto Forum:
Current Time: Thu Jul 24 06:17:32 EDT 2025
Powered by FUDForum. Page generated in 0.27989 seconds
|