11-08-2008 04:09 PM
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);
11-09-2008 01:06 PM
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.
11-13-2008 09:03 AM
11-13-2008 09:28 AM
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); } };
11-21-2008 11:39 AM - edited 12-03-2008 02:46 PM
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).
11-28-2008 07:04 PM