|
Re: Drawing a Shape [message #1083305 is a reply to message #1077271] |
Fri, 09 August 2013 15:44  |
Eclipse User |
|
|
|
Since nobody else has posted, I'll offer my two cents...
I would either extend Shape and duplicate the code in RectangleFigure's source (of course, you would need to add the triangle drawing code into fillShape()) or extend RectangleFigure and just override fillShape().
For example, if you extend RectangleFigure, your class would be something like:
import org.eclipse.draw2d.RectangleFigure;
public class MyShape extends RectangleFigure {
public MyShape() {
}
@Override
protected void fillShape(Graphics graphics) {
// Draw the rectangle. You can also just call graphics.fillRectangle(getBounds()), which is what RectangleFigure.fillShape() does.
super.fillShape(graphics);
// Code to draw triangle goes here...
}
}
I haven't had to use anything beyond ellipses and rectangles yet, so I can't help much in getting the triangle drawn at the moment.
|
|
|
Powered by
FUDForum. Page generated in 0.03730 seconds