PROBLEMA WITH CUSTOMIZE FIGURE [message #493787] |
Wed, 28 October 2009 01:19 |
marco Messages: 82 Registered: September 2009 |
Member |
|
|
package marco.diagram.figures;
import org.eclipse.draw2d.Figure;
import org.eclipse.draw2d.Graphics;
import org.eclipse.draw2d.geometry.Point;
import org.eclipse.draw2d.geometry.PointList;
import org.eclipse.draw2d.geometry.Rectangle;
import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
public class ArchitectureFigure extends Figure {
@Override
public void paint(Graphics graphics) {
Rectangle r = getBounds();
// Define the points of a diamond
Point p1 = new Point(r.x, r.y);
Point p2 = new Point(r.x + r.width-1, r.y);
Point p3 = new Point(r.x + r.width-1, r.y + r.height-1);
Point p4 = new Point(r.x , r.y + r.height-1);
Point p5 = new Point(r.x + r.width-1, r.y + r.height/12);
Point p6 = new Point(r.x , r.y + r.height/12 );
Point p7 = new Point(r.x + r.width-1, r.y + r.height/10);
Point p8 = new Point(r.x , r.y + r.height/10 );
PointList pointList= new PointList();
pointList.addPoint(p1);
pointList.addPoint(p2);
pointList.addPoint(p3);
pointList.addPoint(p4);
pointList.addPoint(p8);
pointList.addPoint(p7);
pointList.addPoint(p5);
pointList.addPoint(p6);
pointList.addPoint(p8);
graphics.drawPolygon(pointList);
// I ALSO TRIED THAT BUT NOTHING HAS
// CHANGED
/*
graphics.drawLine(p1,p2);
graphics.drawLine(p2,p3);
graphics.drawLine(p1,p4);
graphics.drawLine(p6,p5);
graphics.drawLine(p8,p7);
graphics.drawLine(p4,p3);
*/
// Move the label to the centre of the diamond
WrappingLabel label = (WrappingLabel) getChildren().get(0);
LayoutUtil.moveToCenter(label, this, graphics);
label.paint(graphics);
}
}
hi
This Java class implements a figure that I can contain other inside.
I have this problem:
when I create classes within it, does not show the corresponding figure.
I think they are covered by the initial figure.
how can I do to fix this?
make the picture transparent?
I have something wrong in the writing of Java class?
I need help urgently
Thanks to all
marco
[Updated on: Thu, 29 October 2009 19:12] Report message to a moderator
|
|
|
|
Powered by
FUDForum. Page generated in 0.02594 seconds