Skip to main content



      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] Wed, 22 June 2005 22:17 Go to next message
Eclipse UserFriend
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 05:45 Go to previous messageGo to next message
Eclipse UserFriend
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 04:33 Go to previous messageGo to next message
Eclipse UserFriend
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 00: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: Fri May 02 16:33:48 EDT 2025

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

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

Back to the top