由于项目的需要,必须做出以下的自定义图形:
那么我们就一步步的来做出这个图形;

public void paintBorder(Graphics g) {
String name = ((NodeElement) part.getModel()).getName();
Rectangle head = new Rectangle(bounds.x, bounds.y, bounds.width / 4, 15);
Image image = SysDesignUiPluginImages.color.createImage();
g.drawImage(image, new Rectangle(image.getBounds()), head);
g.drawRectangle(head);
Rectangle tail = new Rectangle(bounds.x, bounds.y + 15,bounds.width - 1, bounds.height - 16);
g.drawImage(image, new Rectangle(image.getBounds()), tail);
g.drawRectangle(tail);
Point right = new Point(bounds.x+bounds.width, bounds.y + 15);
Point center = bounds.getCenter();
Point botLeft = bounds.getBottomLeft();
Point topLeft = bounds.getTopLeft();
...........................................................
Point str = new Point(m + 20, (botLeft.y + topLeft.y) / 2);
g.drawString(name, str);
g.drawImage(SysDesignUiPluginImages.contributionimage.createImage(),new Point(m, (botLeft.y + topLeft.y) / 2));

446



被折叠的 条评论
为什么被折叠?



