Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » GEFrc3,eclipse RC3:draw2d can not get the correct result?
GEFrc3,eclipse RC3:draw2d can not get the correct result? [message #185139] Thu, 23 June 2005 02:17 Go to next message
kavin wang is currently offline kavin wangFriend
Messages: 7
Registered: July 2009
Junior Member
Simple code copied from the draw2d sample:

import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Display;
import org.eclipse.draw2d.*;
import org.eclipse.swt.SWT;
import org.eclipse.draw2d.geometry.*;

public class Test1 {
public static void main(String args[]){
Shell shell = new Shell();
shell.open();
shell.setText("Draw2d");
LightweightSystem lws = new LightweightSystem(shell);
lws.getRootFigure().setBackgroundColor(ColorConstants.white) ;
IFigure panel = new Panel();
panel.setLayoutManager(new FlowLayout());
lws.setContents(panel);

Clickable button = new Button("Click me");
Clickable checkbox = new CheckBox("Check box");

Shape ellipse = new Ellipse();
ellipse.setBackgroundColor(ColorConstants.darkBlue);
ellipse.setOpaque(true);
Shape rectangle = new RectangleFigure();
rectangle.setBackgroundColor(ColorConstants.lightBlue);
rectangle.setOpaque(true);

panel.add(button);
panel.add(checkbox);
panel.add(ellipse);
panel.add(rectangle);

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

I can't see the ellipse and rectangle?
Re: GEFrc3,eclipse RC3:draw2d can not get the correct result? [message #185166 is a reply to message #185139] Thu, 23 June 2005 09:45 Go to previous messageGo to next message
Asim Ullah is currently offline Asim UllahFriend
Messages: 24
Registered: July 2009
Junior Member
Do you not have to setSize() first?
e.g

Shape ellipse = new Ellipse();
ellipse.setSize(15,15);
ellipse.setBackgroundColor(ColorConstants.darkBlue);
ellipse.setOpaque(true);
Shape rectangle = new RectangleFigure();
rectangle.setBackgroundColor(ColorConstants.lightBlue);
rectangle.setSize(15,15);
rectangle.setOpaque(true);
Re: GEFrc3,eclipse RC3:draw2d can not get the correct result? [message #185321 is a reply to message #185166] Fri, 24 June 2005 08:33 Go to previous messageGo to next message
kavin wang is currently offline kavin wangFriend
Messages: 7
Registered: July 2009
Junior Member
Thank you!

but that code can run under previous version, that is funny! It must be
something changed in the newer version!


"Asim Ullah" <asimullah@hotmail.com>
??????:201ea58c67ad4f103212752129d8c61f$1@www.eclipse.org...
> Do you not have to setSize() first?
> e.g
>
> Shape ellipse = new Ellipse();
> ellipse.setSize(15,15);
> ellipse.setBackgroundColor(ColorConstants.darkBlue);
> ellipse.setOpaque(true);
> Shape rectangle = new RectangleFigure();
> rectangle.setBackgroundColor(ColorConstants.lightBlue);
> rectangle.setSize(15,15);
> rectangle.setOpaque(true);
>
Re: GEFrc3,eclipse RC3:draw2d can not get the correct result? [message #185431 is a reply to message #185321] Sat, 25 June 2005 04:19 Go to previous message
Eclipse UserFriend
Originally posted by: none.us.ibm.com

Yes, Figures now have a size of 0,0. This is an optimization which reduces
the amount of painting when editing a diagram.
"kavinwang" <kavin.fy.wang@gmail.com> wrote in message
news:d9ggh7$pn9$1@news.eclipse.org...
> Thank you!
>
> but that code can run under previous version, that is funny! It must be
> something changed in the newer version!
>
>
> "Asim Ullah" <asimullah@hotmail.com>
> ??????:201ea58c67ad4f103212752129d8c61f$1@www.eclipse.org...
>> Do you not have to setSize() first?
>> e.g
>>
>> Shape ellipse = new Ellipse();
>> ellipse.setSize(15,15);
>> ellipse.setBackgroundColor(ColorConstants.darkBlue);
>> ellipse.setOpaque(true);
>> Shape rectangle = new RectangleFigure();
>> rectangle.setBackgroundColor(ColorConstants.lightBlue);
>> rectangle.setSize(15,15);
>> rectangle.setOpaque(true);
>>
>
>
Previous Topic:Why is UndoablePropertySheetEntry final?
Next Topic:Saving as an XML document
Goto Forum:
  


Current Time: Tue Dec 03 09:45:23 GMT 2024

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

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

Back to the top