Dashboard > UDIG Developer Guide > Home > 4 Working with Eclipse RCP > 11 Working with SWT and JFace > Adding Control Decorations
Adding Control Decorations Log In | Sign Up   View a printable version of the current page.

Added by Emily Gouge , last edited by Emily Gouge on Aug 06, 2008
Labels: 
(None)

To add a decorator to a label (the 'x' and '!' that appear with warning and labels) you can use the ControlDecoration as shown here:

final Image fieldDecorationWarningImage;
fieldDecorationWarningImage = FieldDecorationRegistry.getDefault().getFieldDecoration(FieldDecorationRegistry.DEC_WARNING).getImage();       
warningDecorator = new ControlDecoration(label, SWT.LEFT | SWT.CENTER);
warningDecorator.setMarginWidth(4);
warningDecorator.setImage(fieldDecorationWarningImage);
warningDecorator.setDescriptionText("Warning!");

To show the label decoration:

 warningDecorator.show();

To hide the label decoration

 warningDecorator.hide();
Powered by a free Atlassian Confluence Open Source Project License granted to uDig. Evaluate Confluence today.
Powered by Atlassian Confluence 2.7.1, the Enterprise Wiki. Bug/feature request - Atlassian news - Contact administrators
User-friendly Desktop Internet GIS