Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » Problem with setOpaque()
Problem with setOpaque() [message #196820] Tue, 27 September 2005 12:43 Go to next message
Jens Bartelheimer is currently offline Jens BartelheimerFriend
Messages: 44
Registered: July 2009
Member
Hi,

I have a problem with the method setOpaque(). I need a transparent
figure but this method does nothing?!?

Here my code:

The second rectangle overlaps the first one. The second rectangle should
be transparent so that I could see the first one. But this doesn't work.
What is wrong?


public class A {
public static void main(String args[]) {
Shell shell = new Shell();
shell.setSize(200, 300);
shell.open();
shell.setText("Chart");
LightweightSystem lws = new LightweightSystem(shell);
Figure f=new Figure();
f.setLayoutManager(new XYLayout());
lws.setContents(f);

RectangleFigure a = new RectangleFigure();
a.setSize(10,10);
a.setLocation(new Point(10,10));
f.add(a);

RectangleFigure b = new RectangleFigure();
b.setSize(10,10);
b.setLocation(new Point(15,15));
b.setOpaque(false);
f.add(b);

Display display = Display.getDefault();
while (!shell.isDisposed()) {
if (!display.readAndDispatch())
display.sleep();
}
}
}

Jens.
Re: Problem with setOpaque() [message #196866 is a reply to message #196820] Tue, 27 September 2005 15:42 Go to previous message
Eclipse UserFriend
Originally posted by: none.unknown.com

Shapes are special figures, and you need to use setFill(false) if you want
them to be transparent.

"Jens" <jens.bartelheimer@gmx.de> wrote in message
news:dhbeor$ccg$1@news.eclipse.org...
> Hi,
>
> I have a problem with the method setOpaque(). I need a transparent
> figure but this method does nothing?!?
>
> Here my code:
>
> The second rectangle overlaps the first one. The second rectangle should
> be transparent so that I could see the first one. But this doesn't work.
> What is wrong?
>
>
> public class A {
> public static void main(String args[]) {
> Shell shell = new Shell();
> shell.setSize(200, 300);
> shell.open();
> shell.setText("Chart");
> LightweightSystem lws = new LightweightSystem(shell);
> Figure f=new Figure();
> f.setLayoutManager(new XYLayout());
> lws.setContents(f);
>
> RectangleFigure a = new RectangleFigure();
> a.setSize(10,10);
> a.setLocation(new Point(10,10));
> f.add(a);
>
> RectangleFigure b = new RectangleFigure();
> b.setSize(10,10);
> b.setLocation(new Point(15,15));
> b.setOpaque(false);
> f.add(b);
>
> Display display = Display.getDefault();
> while (!shell.isDisposed()) {
> if (!display.readAndDispatch())
> display.sleep();
> }
> }
> }
>
> Jens.
Previous Topic:paintFigure() problem
Next Topic:dangling connection
Goto Forum:
  


Current Time: Tue Jan 21 20:02:08 GMT 2025

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

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

Back to the top