Skip to main content



      Home
Home » Eclipse Projects » GEF » using ImageFigure
using ImageFigure [message #121105] Tue, 09 March 2004 10:46 Go to next message
Eclipse UserFriend
I would like to use an image, like a bmp file, for my object figures in a
GEF
editor. To evaluate this I started with the LinklessNetworkEditor and
LinklessNetworkModel eamples. I modified the NodeFigure.java to extend
ImageFigure rather than Ellipse. When I run the editor and add a new node
I see the image of my bmp file, but I can not move it. When I select the
node and move it the image does not follow. It looks like the extent box
of the node is a view 'window' on the canvas. When I move it back to the
original location of the image I see it again.

Can anyone explain what is happening and help me pls. See a code fragment
below.

Thanks,

Mark.

...

public class NodeFigure
extends ImageFigure
{
protected EllipseAnchor incomingConnectionAnchor;
protected EllipseAnchor outgoingConnectionAnchor;
protected Label label;
protected XYLayout layout;


public NodeFigure(Image image) {

layout = new XYLayout();
setLayoutManager( layout );

setImage(image);

setBackgroundColor( ColorConstants.white );
setOpaque( false);

incomingConnectionAnchor = new EllipseAnchor(this);
outgoingConnectionAnchor = new EllipseAnchor(this);
label = new Label("");
add(label);

}
...
Re: using ImageFigure [message #121192 is a reply to message #121105] Wed, 10 March 2004 04:11 Go to previous message
Eclipse UserFriend
Originally posted by: brian.fernandes.codito.com

Hi Mark,

I haven't come across NodeFigure nor the examples you've mentioned.

Anyhow, if you just need to display an image in your diagram, you might try
using a Label, and use Label#setIcon to display the image you want. I
suppose you can load the Images as you're doing right now.

Works for me - though I don't know if you need anything specific to
NodeFigure.

Hope this helps,

All the best,
Brian.


"Mark Geib" <mark.geib@echostar.com> wrote in message
news:c2koss$u02$1@eclipse.org...
> I would like to use an image, like a bmp file, for my object figures in a
> GEF
> editor. To evaluate this I started with the LinklessNetworkEditor and
> LinklessNetworkModel eamples. I modified the NodeFigure.java to extend
> ImageFigure rather than Ellipse. When I run the editor and add a new node
> I see the image of my bmp file, but I can not move it. When I select the
> node and move it the image does not follow. It looks like the extent box
> of the node is a view 'window' on the canvas. When I move it back to the
> original location of the image I see it again.
>
> Can anyone explain what is happening and help me pls. See a code fragment
> below.
>
> Thanks,
>
> Mark.
>
> ..
>
> public class NodeFigure
> extends ImageFigure
> {
> protected EllipseAnchor incomingConnectionAnchor;
> protected EllipseAnchor outgoingConnectionAnchor;
> protected Label label;
> protected XYLayout layout;
>
>
> public NodeFigure(Image image) {
>
> layout = new XYLayout();
> setLayoutManager( layout );
>
> setImage(image);
>
> setBackgroundColor( ColorConstants.white );
> setOpaque( false);
>
> incomingConnectionAnchor = new EllipseAnchor(this);
> outgoingConnectionAnchor = new EllipseAnchor(this);
> label = new Label("");
> add(label);
>
> }
> ...
>
>
Previous Topic:Why isn't the SelectionTool working?
Next Topic:HotKey for Multipage graphical editor
Goto Forum:
  


Current Time: Mon Jul 07 23:36:47 EDT 2025

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

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

Back to the top