Transparent Canvas inside a composite parent [message #1768778] |
Sun, 23 July 2017 19:48 |
Sudharshan Gopikrishnan Messages: 15 Registered: April 2017 |
Junior Member |
|
|
Hello all,
I am using Nebula visualization widgets in my projects. The widgets are created on top of a canvas. The canvas sits on the top of a composite parent.
The problem i face is that, the canvas can be clearly differentiated from the underlying composite parent. I want to make them indifferentiable.
The Code I am using :
Composite comp = new Composite(folder, SWT.None);
GridLayout layout = new GridLayout();
layout.numColumns = 4;
GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true);
comp.setLayout(layout);
// creating canvases to hold the widgets.
Canvas knobCanvas = new Canvas(comp, SWT.BORDER);
knobCanvas.setLayoutData(gd);
Canvas gaugeCanvas = new Canvas(comp, SWT.BORDER);
gaugeCanvas.setLayoutData(gd);
Canvas thermoCanvas = new Canvas(comp, SWT.BORDER);
thermoCanvas.setLayoutData(gd);
Canvas tankCanvas = new Canvas(comp, SWT.BORDER);
tankCanvas.setLayoutData(gd);
Canvas knobCanvas1 = new Canvas(comp, SWT.BORDER);
knobCanvas1.setLayoutData(gd);
// use LightweightSystem to create the bridge between SWT and draw2D
LightweightSystem lws = new LightweightSystem(knobCanvas);
// Create widgets
final KnobFigure knobFigure = new KnobFigure();
lws.setContents(knobFigure);
lws = new LightweightSystem(gaugeCanvas);
final GaugeFigure gauge = new GaugeFigure();
gauge.setBackgroundColor(XYGraphMediaFactory.getInstance().getColor(0, 0, 0));
gauge.setForegroundColor(XYGraphMediaFactory.getInstance().getColor(255, 255, 255));
lws.setContents(gauge);
lws = new LightweightSystem(thermoCanvas);
final ThermometerFigure thermo = new ThermometerFigure();
lws.setContents(thermo);
lws = new LightweightSystem(tankCanvas);
final TankFigure tank = new TankFigure();
lws.setContents(tank);
lws = new LightweightSystem(knobCanvas1);
final KnobFigure knobFigure1 = new KnobFigure();
lws.setContents(knobFigure1);
I have tried many methods, but none of them work unfortunately. Please see the attached Pic for the reference. What I am trying to do is remove the clearly visible canvas and make them match with the background. Is there any method to make the the canvas transparent? Any help will be appreciated !
Regards,
Sudharshan
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03616 seconds