GraphStream Users

Archives de la liste Aide

Re: sprite help

Chronologique Discussions 
  • From: Antoine Dutot <antoine.dutot AT>
  • To: "graphstream-users AT" <graphstream-users AT>
  • Subject: Re: sprite help
  • Date: Tue, 12 Nov 2013 12:05:58 +0100


For question 1 : You can have a look at the DefaultMouseManager used by each View (Viewer.getDefaultView()) and change it using View.setMouseManager().

The method to override is elementMoving(). Just add a test on the kind of element (instance of GraphicSprite), and they will not receive mouse clicks.

For questions 2 and 3 you can use a mix of MouseManager,  Stylesheet and the « ui.hide » attribute (see Also you can reset the sprite position in Sprite.setPosition (see org.graphstream.ui.spriteManager) if it has been moved.

Hope this helps.


2013/11/11 <gzahoransky-kohalmi AT>
Hello List,

First of all I'd like to say thanks for your effort to create this great graph

I'd like to ask your help in three questions related to handling sprites.

1. Can I make the sprites non-clickable so that users can't move them around?

2. Can I reset (re-position to edge) sprites in the case user incidentally
drags them away from their edge?

3. Can I make sprites hide and reappear (at the respective edge) upon user
initiated event (e.g. mouse click)? I tried using the detach method of sprites
but that put all the sprites on top of each other, but I could not make them
disappear. I also noticed that in the case of moving a sprite away from its
edge, then doing the detach-reattach cycle the sprite won't appear at the
original edge but somewhere else.

Any help would be greatly appreciated!



  • sprite help, gzahoransky-kohalmi, 11/11/2013
    • Re: sprite help, Antoine Dutot, 12/11/2013
    • <Suite(s) possible(s)>
    • Re: sprite help, Gergely Zahoransky-Kohalmi, 13/11/2013

Archives gérées par MHonArc 2.6.16.

Top of page