Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
New Developer
MourningWood
Posts: 15
Registered: ‎11-08-2008
My Device: 8330 Curve

ActiveRichTextField Backgournd

A wrote an app that brings up about two pages of info in an ActiveRichTextField.  I've got my app working great and set out to make it visually appealing, that's where it got hard for me.  After hours of searching I finally found enough info to change it but it didn't work out as planned.  I'm using the setAttributes() method provided with ActiveRichTextField but it only changes the color of the text and the background directly behind the text.  I've also used other methods to change background color that change the background color of the screen but the texts field takes up the whole screen so it turned out to be useless.  Any help would be greatly appreciated and maybe a few pointers to dress it up more than just changes to text and background colors.

 

I couldn't find any documentation on how many values the int[] holds and what they are for, I just had to guess at it.  

 

This is just the basic template, the actual text field is quite large.

 

fg = foreground

bg = background

 

 

ActiveRichTextField a1 = new ActiveRichTextField("some text"); int[] fg = new int[3]; fg[0] = 0xffffff; fg[1] = 0x1800ff; fg[2] = 0x1800ff; int[] bg = new int[10]; bg[0] = 0x3f3e4d; bg[1] = 0x3f3e4d; bg[2] = 0x3f3e4d; bg[3] = 0x3f3e4d; a1.setAttributes(fg, bg);

 

 

 

Please use plain text.
New Developer
MourningWood
Posts: 15
Registered: ‎11-08-2008
My Device: 8330 Curve

Re: ActiveRichTextField Backgournd

Update:

 

I've been able to change the background color overriding the paintBackground method but it comes up as black no matter what color I choose and the text comes up as white.

Please use plain text.
Administrator
MSohm
Posts: 14,566
Registered: ‎07-09-2008
My Device: BlackBerry Z30, BlackBerry PlayBook

Re: ActiveRichTextField Backgournd

Can you post a code snippet of your paintBackground method?
Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker
Please use plain text.
New Developer
MourningWood
Posts: 15
Registered: ‎11-08-2008
My Device: 8330 Curve

Re: ActiveRichTextField Backgournd

Thank you for replying.  Here is the code I used for an ActiveRichTextField, it changes the text and the background color but only to black for the background and white for the text. I've tried the same thing for the screen but nothing changes.  I know i'm doing something wrong but just can't seem to figure it out.  I would love to completely customize my apps including the scroll bar and top menu.

ActiveRichTextField fontTxt = new ActiveRichTextField("Whole lot of text"){ public void paint(Graphics graphics) { graphics.setColor(0xffffff); super.paint(graphics); } public void paintBackground(Graphics graphics) { graphics.setBackgroundColor(0x3f3e4d); graphics.fillRect(0, 0, Display.getWidth(), Display.getHeight() 2); } };

 

 

 

 

Please use plain text.
Administrator
MSohm
Posts: 14,566
Registered: ‎07-09-2008
My Device: BlackBerry Z30, BlackBerry PlayBook

Re: ActiveRichTextField Backgournd

[ Edited ]

Note that the following hierarchy exists:

 

1.  Screen level.

2.  Manager level.

3.  Field level.

 

This means that a manager will paint on top of a screen.  Therefore you'll need to override the paint method of the manager on your screen, not the screen itself (unless you are drawing directly to a screen with no managers and fields present).

Message Edited by MSohm on 12-03-2008 02:46 PM
Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker
Please use plain text.
New Developer
MourningWood
Posts: 15
Registered: ‎11-08-2008
My Device: 8330 Curve

Re: ActiveRichTextField Backgournd

Thank you for your input, I wasn't thinking of any kind of hierchy.  I'm going to try and redo my code with that in mind, I'll let you know how it turns out.
Please use plain text.