Skip to content

Instantly share code, notes, and snippets.

@kthoms
Created February 8, 2012 17:02
Show Gist options
  • Save kthoms/1771065 to your computer and use it in GitHub Desktop.
Save kthoms/1771065 to your computer and use it in GitHub Desktop.
Spray_Listing_Styles_BlackAndWhiteStyle_Java
IGaService gaService = Graphiti.getGaService();
// Creating Style with given id and description
Style style = super.getStyle(diagram);
style.setId("BlackAndWhiteStyle");
style.setDescription("A style with white background and black foreground.");
// transparency value
style.setTransparency(0.95);
// background attributes
style.setFilled(true);
style.setBackground(gaService.manageColor(diagram, IColorConstant.BLACK));
// line attributes
style.setLineVisible(true);
style.setForeground(gaService.manageColor(diagram, IColorConstant.BLACK));
style.setLineWidth(1);
style.setLineStyle(LineStyle.SOLID);
// font attributes
String fontName = "Tahoma";
int fontSize = 10;
boolean fontItalic = true;
boolean fontBold = true;
style.setFont(gaService.manageFont(diagram, fontName, fontSize, fontItalic, fontBold));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment