1 - how do I display a string in color red (or other)? 2 - same question for a font 3 - how do I display a string with a yellow (or other color) background? Herve Franceschi
neither strings nor fonts have the capability to be displayed in color.
you have to put the string/font into something derived from Component to display it in the first place, though. a good component to display text with is a Label.
Label inherits six important methods from Component which will allow you to display colored text - getForeground(), setForeground(Color fg), getBackground() and setBackground(Color bg) for managing colors, and getFont() and setFont(Font f) for managing fonts.
you'll end up with something like:
Label foo = new Label (stringVariable); foo.setForeground(foregroundColorVariable); foo.setBackground(backgroundColorVarialbe); foo.setFont(fontVariable); -calyxa