setAlpha() + setImage() on a figure problem [message #236935] |
Fri, 13 July 2007 18:46 |
Eclipse User |
|
|
|
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
|
|
|
Powered by
FUDForum. Page generated in 0.02699 seconds