File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java Micro Edition and the fly likes Changing the text color Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Mobile » Java Micro Edition
Bookmark "Changing the text color" Watch "Changing the text color" New topic

Changing the text color

sara shamsi

Joined: May 07, 2004
Posts: 3
Dear all ..
How can I change the color of text with out using "graphic g"??
good bye
David Price
Ranch Hand

Joined: Jan 22, 2003
Posts: 93
I guess you mean: "How can I change the text colour in MIDP high-level UI screens (Form, List, TextBox)?". The simple answer is: you can't - these screens use the phone's native fonts and colour settings.
You can only change the text colour in MIDP low-level UI screens (Canvas, MIDP 2.0 GameCanvas) and in MIDP 2.0 'CustomItems' (items on a form which are each like a little Canvas). These all use that 'Graphics g'.
sara shamsi

Joined: May 07, 2004
Posts: 3
Thank you David ..
ok if I can't change the text colour in MIDP high-level UI screens... can I highlights the text ??
Michael Yuan
Ranch Hand

Joined: Mar 07, 2002
Posts: 1427
You can underline text, make it bold or use any supported font in the high level API. Refer to the "Font" and StringItem" classes in the javadoc.

Seam Framework:
I agree. Here's the link:
subject: Changing the text color
Similar Threads
Display colored output to a console/terminal with java
Hiding button label when button is disable
How to conditionally change text color?
How to change the color of text-decoration:line-through to red instead of black?