|
|
|
|
sample-howto: use of png-icon in figure [message #54525 is a reply to message #54499] |
Sun, 24 September 2006 17:33  |
Eclipse User |
|
|
|
Hi Andy,
I displayed png-icons in my diagram included in a rectangle-figure.
I'll include sample code of the figure below. hope it helps you.
------------------code:
> public class BranchTypeFigure extends org.eclipse.draw2d.RectangleFigure {
>
> private ImageDescriptor imgdesc;
> private Image img;
> /**
> * @generated
> */
> public BranchTypeFigure() {
>
> createContents();
> }
> private void createContents() {
> org.eclipse.gmf.runtime.draw2d.ui.figures.WrapLabel fig_0 = new org.eclipse.gmf.runtime.draw2d.ui.figures.WrapLabel();
> fig_0.setText("Branch");
> fig_0.setTextPlacement(PositionConstants.SOUTH);
>
> imgdesc = SequenzeditorDiagramEditorPlugin.findImageDescriptor("/Sequenz-Editor.diagram/icons/branch.png ");
> img = imgdesc.createImage();
>
> fig_0.setIcon(img);
> fig_0.setIconAlignment(PositionConstants.TOP);
>
> setFigureBranchFigure(fig_0);
>
> Object layData0 = null;
>
> this.add(fig_0, layData0);
> }
Greets Alex Haag
|
|
|
Powered by
FUDForum. Page generated in 0.04064 seconds