Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Re: Watermark
Re: Watermark [message #444515] Thu, 14 October 2004 16:06 Go to next message
Eclipse UserFriend
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 Go to previous message
Eclipse UserFriend
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
Previous Topic:Why is my status line in the wrong spot?
Next Topic:FileDialog Extension Filter does not work ?!
Goto Forum:
  


Current Time: Mon Oct 26 19:07:32 GMT 2020

Powered by FUDForum. Page generated in 0.01775 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top