Jump to content
Changes to the Jaspersoft community edition download ×

Back Color & Fore Color Change


atharindhi

Recommended Posts

Hi All,

I want to change the Field's Back color and Fore Color when the code changes..
How can i do this.

Can i pass the Hexadecimal color code as a parameter

I cant use the Print When expression bacause the user can add new colors to the codes..
So Expression won't help here.

The Hexadecimal code is the only way to pass the tow colors (Im using Fore Color because when comes to dark colors the default black color fonts won't display properly )

 

Any help would be a appreciated

 

Link to comment
Share on other sites

  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

You cant use fields/variables for setting fg/bg colors on elements...

 

If you dont want to use styled text, my best solution so far, is to create a 1x1 buffered java awt image, and set this as an available field. You can then use this image along with fill-frame to set a nice bg color defined at runtime...

 

E.g:

 

<image scaleImage="FillFrame">
<reportElement x="0" y="0" width="71" height="15"/>
<imageExpression class="java.awt.Image"><![CDATA[$F{image}]]></imageExpression>
</image>

 

Hope this helps...

Link to comment
Share on other sites

Thanx for the help...

Nw i have a octal color code saved in my database (code like [255,102,0])

so i wnat to change the text field Back Color according to the code

I means i have diffetent color code (code like [255,102,0] , [255,51,204],[255,255,51) saved in database. when code change the back color also should change..

Can i do this..
If so how..

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...