Setting backcolor

By: Mark Engstrom - me2kme
Setting backcolor
2002-07-29 03:20

Hi,

I have some java code that is modifying a report design, particularly attempting to set the fore and back color of <textFields>. For example :-

JRDesignTextField textField = new JRDesignTextField();
textField.setBlankWhenNull(true);
textField.setStretchWithOverflow(true);
Integer nextXPos = (Integer)m_data[1];
textField.setX(nextXPos.intValue());
textField.setY(0);
Integer width = (Integer)m_data[2];
textField.setWidth(width.intValue());
textField.setHeight(8);
textField.setTextAlignment(JRDesignTextField.TEXT_ALIGN_LEFT);
JRDesignExpression r = new JRDesignExpression();
r.addFieldChunk(columnName);
r.setValueClass(columnName.getClass());
textField.setExpression(r);

Boolean flag = new Boolean(true);
if ( j == 0 ) {
// If there is an account specified. Set to Cyan.
textField.setForecolor(new Color(77, 188, 252)); .................................

When I compile and generate the report, the text is coloured accordingly. What I want to do is set the backcolor property but this doesn't seem to have any effect on the report.

Is there some other condition I need to set, can anyone help ?.

Thank you.

Mark


By: Teodor Danciu - teodord
RE: Setting backcolor
2002-08-05 02:54

Hi,

You need this:

textField.setMode(JRElement.MODE_OPAQUE);

Text elements are transparent by default.

Good luck!
Teodor



By: Bart Cassady - bartong
RE: Setting backcolor
2002-10-09 13:41
Would you then update your Quick Reference documentation to reflect this?

It currently states that the default mode IS "Opaque",

Thanks.

Bart


By: Teodor Danciu - teodord
RE: Setting backcolor
2002-10-09 15:26

Hi,

I'll do that.

Thank you,
Teodor
2001 JI Open Discussion's picture
Joined: Aug 10 2006 - 3:26am
Last seen: 17 years 1 month ago

0 Answers:

No answers yet
Feedback