Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » IFigure.setBackgroundColor
IFigure.setBackgroundColor [message #238264] Tue, 04 September 2007 02:49 Go to next message
Eclipse UserFriend
Originally posted by: jorge.matos_.-gmail.com

Hello!

I want to pass by all elements in my diagram and while i'm passing for them
I want to change the background color to make a simulation of a workflow
execution.

My problem is that if the figures already have a color even if I change to
another color with the setbackground(new Color(null, 0, 44, 0)) doesn't work
:(

But if the figures don't have any color it works fine!!

Can anyone help me to change the color of a figure that have a previous
color?

This is my code:

public static void ExecutionSimulation(IFigure figure){

oldColor = figure.getBackgroundColor();


try {

// figure.setBackgroundColor(new Color(null, 220, 220, 250));

figure.setBackgroundColor(new Color(null, 220, 220, 0));



Thread.sleep(1000);

} catch (InterruptedException e) {

e.printStackTrace();

}

figure.setBackgroundColor(oldColor);

}


Thanks in advance and sorry for my bad english...

PS: The figure is from an editpart
Re: IFigure.setBackgroundColor [message #238313 is a reply to message #238264] Wed, 05 September 2007 05:07 Go to previous messageGo to next message
Andreas Schosser is currently offline Andreas SchosserFriend
Messages: 30
Registered: July 2009
Member
Hi,

did you call the figure's revalidate (/repaint) method?
If the figure is not being repainted, the colors will never change.

Kind regards,

Andreas

Jorge Matos schrieb:
> Hello!
>
> I want to pass by all elements in my diagram and while i'm passing for them
> I want to change the background color to make a simulation of a workflow
> execution.
>
> My problem is that if the figures already have a color even if I change to
> another color with the setbackground(new Color(null, 0, 44, 0)) doesn't work
> :(
>
> But if the figures don't have any color it works fine!!
>
> Can anyone help me to change the color of a figure that have a previous
> color?
>
> This is my code:
>
> public static void ExecutionSimulation(IFigure figure){
>
> oldColor = figure.getBackgroundColor();
>
>
> try {
>
> // figure.setBackgroundColor(new Color(null, 220, 220, 250));
>
> figure.setBackgroundColor(new Color(null, 220, 220, 0));
>
>
>
> Thread.sleep(1000);
>
> } catch (InterruptedException e) {
>
> e.printStackTrace();
>
> }
>
> figure.setBackgroundColor(oldColor);
>
> }
>
>
> Thanks in advance and sorry for my bad english...
>
> PS: The figure is from an editpart
>
>
Re: IFigure.setBackgroundColor [message #238465 is a reply to message #238313] Tue, 11 September 2007 14:48 Go to previous message
Eclipse UserFriend
Originally posted by: jorge.matos_.-gmail.com

Hello!

Yeas, I called repaint and refresh, but still doesn't solved the problem.

Fortunally I've found the problem: I have to make the change with the
setBackground to the childrens of the figure and not for the figure itself.

But I still can't explain why the setBackgound works if I don't give a
default color do the figure.

"A. Schosser" <andreas.schosser@mind8.com> wrote in message
news:fbldi2$ggv$1@build.eclipse.org...
> Hi,
>
> did you call the figure's revalidate (/repaint) method?
> If the figure is not being repainted, the colors will never change.
>
> Kind regards,
>
> Andreas
>
> Jorge Matos schrieb:
>> Hello!
>>
>> I want to pass by all elements in my diagram and while i'm passing for
>> them I want to change the background color to make a simulation of a
>> workflow execution.
>>
>> My problem is that if the figures already have a color even if I change
>> to another color with the setbackground(new Color(null, 0, 44, 0))
>> doesn't work :(
>>
>> But if the figures don't have any color it works fine!!
>>
>> Can anyone help me to change the color of a figure that have a previous
>> color?
>>
>> This is my code:
>>
>> public static void ExecutionSimulation(IFigure figure){
>>
>> oldColor = figure.getBackgroundColor();
>>
>>
>> try {
>>
>> // figure.setBackgroundColor(new Color(null, 220, 220, 250));
>>
>> figure.setBackgroundColor(new Color(null, 220, 220, 0));
>>
>>
>>
>> Thread.sleep(1000);
>>
>> } catch (InterruptedException e) {
>>
>> e.printStackTrace();
>>
>> }
>>
>> figure.setBackgroundColor(oldColor);
>>
>> }
>>
>>
>> Thanks in advance and sorry for my bad english...
>>
>> PS: The figure is from an editpart
Previous Topic:Error in Clipboard.getContents() method
Next Topic:Adding a MouseScrollWheel listener to a Figure - how?
Goto Forum:
  


Current Time: Fri Mar 29 00:40:41 GMT 2024

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

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

Back to the top