Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » change BackgroundColor dynamically
change BackgroundColor dynamically [message #226248] Wed, 08 November 2006 16:29 Go to next message
Eclipse UserFriend
Originally posted by: mouna.feki.siemens.com

hi,
My figure is a rectangle(has as BackgroundColor green)
how can i change dynamically the backgroundColor of my figure, when the
cursor is moved over it? (the Figure will be red "only !!!" when the
cursor over).

Thanks
Mouna
Re: change BackgroundColor dynamically [message #226259 is a reply to message #226248] Wed, 08 November 2006 17:11 Go to previous messageGo to next message
Anthony Hunter is currently offline Anthony HunterFriend
Messages: 446
Registered: July 2009
Senior Member
Hi Mouna,

Look at adding a MouseMotionListener to your Figure.

Cheers...
Anthony

"Mouna" <mouna.feki@siemens.com> wrote in message
news:53f5d3afde6c18cbd7b29c2065974759$1@www.eclipse.org...
> hi, My figure is a rectangle(has as BackgroundColor green)
> how can i change dynamically the backgroundColor of my figure, when the
> cursor is moved over it? (the Figure will be red "only !!!" when the
> cursor over).
>
> Thanks Mouna
>
Re: change BackgroundColor dynamically [message #226267 is a reply to message #226248] Wed, 08 November 2006 18:39 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: none.ibm.com

If you are using GEF with draw2d, you should respond to requests to update
your figure's color. For example, SELECTION, SELECTION_HOVER, CREATION, and
CREATION_HOVER show feedback requests. This allows the color change to
happen in a certain context.

"Mouna" <mouna.feki@siemens.com> wrote in message
news:53f5d3afde6c18cbd7b29c2065974759$1@www.eclipse.org...
> hi, My figure is a rectangle(has as BackgroundColor green)
> how can i change dynamically the backgroundColor of my figure, when the
> cursor is moved over it? (the Figure will be red "only !!!" when the
> cursor over).
>
> Thanks Mouna
>
Re: change BackgroundColor dynamically [message #226269 is a reply to message #226267] Wed, 08 November 2006 19:37 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: mouna.feki.siemens.com

Hi Randy,
yes,i use the draw2d package.
have you a code Example for this function ?
i have added a mouse Listner in my figure, but it dónt worked.
Thanks
Mouna
Re: change BackgroundColor dynamically [message #226274 is a reply to message #226259] Wed, 08 November 2006 19:52 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: mouna.feki.siemens.com

Hi Anthony,
the default color of my figure is red.
i have added a MouseMotionListner to my Figure. but as result was the
color changed (green )only one time : the first time, where the cursor
moved over the Figure.
when the cursor is not on Figure is the color always green .
Bút i want in this case that the figure set again the default color
(red).

have an Example for this ?

Thanks
Mouna
Re: change BackgroundColor dynamically [message #226404 is a reply to message #226274] Fri, 10 November 2006 21:32 Go to previous message
Anthony Hunter is currently offline Anthony HunterFriend
Messages: 446
Registered: July 2009
Senior Member
Hi Mouna,

There is a EllipseHitting example for the MouseMotionListner in the draw2d
examples:

http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.draw2d. examples/src/org/eclipse/draw2d/examples/hittest/EllipseHitt ing.java?cvsroot=Tools_Project

It does exactly what you are asking:
white ovals on a diagram, when you move your mouse over an oval it turns
yellow, move the mouse off and it turns white again.

Cheers...
Anthony

"Mouna" <mouna.feki@siemens.com> wrote in message
news:fb5ee87c50396448efee8fb7c8223f05$1@www.eclipse.org...
> Hi Anthony, the default color of my figure is red.
> i have added a MouseMotionListner to my Figure. but as result was the
> color changed (green )only one time : the first time, where the cursor
> moved over the Figure.
> when the cursor is not on Figure is the color always green .
> B
Previous Topic:How to make connections go under the diagram?
Next Topic:change the container of model
Goto Forum:
  


Current Time: Mon Oct 25 18:14:10 GMT 2021

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

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

Back to the top