Re: Watermark [message #444515] |
Thu, 14 October 2004 16:06 |
Eclipse User |
|
|
|
Originally posted by: eproulx.ubiquity.net
Answering my own question:
public class WatermarkRootEditPart extends FreeformGraphicalRootEditPart {
private static final String WATERMARK_LAYER = "Watermark layer";
protected void createLayers(LayeredPane layeredPane) {
Image i = new Image(null ,
getClass().getResourceAsStream("watermark.gif"));
ImageFigure logo = new ImageFigure(i);
logo.setEnabled(false);
logo.setOpaque(false);
logo.setFocusTraversable(false);
logo.setRequestFocusEnabled(false);
logo.setValid(false);
FreeformLayer watermarkLayer = new FreeformLayer();
layeredPane.addLayerBefore(watermarkLayer, WATERMARK_LAYER,
null);
watermarkLayer.setLayoutManager(new XYLayout());
watermarkLayer.add(logo, new Rectangle(5, 5,
i.getImageData().width,
i.getImageData().height));
super.createLayers(layeredPane);
}
}
Now in the editor class:
public class MyEditor extends GraphicalEditorWithPalette {
...
protected void configureGraphicalViewer() {
super.configureGraphicalViewer();
getGraphicalViewer().setRootEditPart(new
WatermarkRootEditPart());
...
}
...
}
If this helps let me know.
Emmanuel
"Emmanuel Proulx" <eproulx@ubiquity.net> wrote in message
news:<ckjrn5$b0b$1@eclipse.org>...
> Dear SWT experts,
>
> I'm trying to add a watermark graphic into my diagram. I can load the
> Image and add it to a diagram as an ImageFigure, but the figure selection
> is wrong; new Figures show up "under" the watermark. I'd like to put this
> "below" all other figures.
|
|
|
Re: Watermark [message #444627 is a reply to message #444515] |
Sun, 17 October 2004 14:28 |
Eclipse User |
|
|
|
Originally posted by: paolino125.hotmail.com
Hi! Yes it's very useful and I need such as example but...for me doesn't
work...I run your code in my editor and nothing appears. If I comment last
line (super.createLayers(layeredPane)) the image appears, but obviously all
other layer disappears...You can mind why? If yes tanks a lot!
Funky79
|
|
|
Powered by
FUDForum. Page generated in 0.02760 seconds