Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » setAlpha() + setImage() on a figure problem
setAlpha() + setImage() on a figure problem [message #236935] Fri, 13 July 2007 18:46
Eclipse UserFriend
Originally posted by: bdmeck.cs.wm.edu

I am having issues getting an image to display properly on top of a
semi-transparent figure. I first create a semi-transparent rectangle
figure and then assign another non-transparent figure, consisting of text
and an image, as a child of the rectangle figure. On some machines this
displays fine while on others eclipse will only show the rectangle figure
and not render the text or image. Below is a sample of my figure class:

public class MyFigure extends Figure {
protected TextFigure textFigure;
protected Label label;

public class TextFigure extends Figure {
public TextFigure() {
this.label = new Label();
this.label.setText("text");
enableIcon(true);

ToolbarLayout layout = new ToolbarLayout();
layout.setMinorAlignment(ToolbarLayout.ALIGN_CENTER);
setLayoutManager(layout);
this.label.setBorder(new MarginBorder(3));

add(this.label);
}

public void enableIcon(boolean bool) {
if (bool) {
this.label.setIcon(Activator.
getImageDescriptor("icons/jcu_obj.png").createImage());
} else {
this.label.setIcon(null);
}
}

public void paint(Graphics graphics) {
graphics.setAlpha(255);
super.paint(graphics);
}

public MyFigure(Color color) {
this.textFigure = new TextFigure();

ToolbarLayout layout = new ToolbarLayout();
layout.setMinorAlignment(ToolbarLayout.ALIGN_CENTER);
setLayoutManager(layout);

setOpaque(false);
RectangleFigure rectangle = new RectangleFigure();
rectangle.setBackgroundColor(color);
rectangle.setLayoutManager(layout);
rectangle.add(this.textFigure);

add(rectangle);
}

public void paint(Graphics graphics) {
graphics.setAlpha(180);
super.paint(graphics);
}
}

Any ideas or should I submit this as a bug?

Thanks in advance,
-Brian
Previous Topic:ComboBox in Properties View
Next Topic:How to add a Text Editing tool?
Goto Forum:
  


Current Time: Thu Apr 25 17:59:14 GMT 2024

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

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

Back to the top