Originariamente inviato da LeleFT
Sì... ma a parte il fatto che le costanti Color sono minuscole (cosa, secondo me, alquanto strana)

Infatti per ogni "costante minuscola" c'è anche la corrispondente "maiuscola", es Color.black e Color.BLACK, ecc ecc...


Un'interessante caratteristica di molti componenti swing che permette di gestire font/colori/allineamento è data dalla possibilità di formattare il contenuto del componente attraverso tag html proprio come se fosse una pagina web:

(da http://java.sun.com/docs/books/tutor...ents/html.html)


If you want to mix fonts or colors within the text, or to have formatting such as multiple lines, you can use HTML. HTML formatting can be used in all Swing buttons, menu items, labels, tool tips, and tabbed panes, as well as in components such as trees and tables that use labels as renderers.

To specify that a component's text has HTML formatting, just put the <html> tag at the beginning of the text, then use any valid HTML in the remainder. Here is an example of using HTML in a button's text:

button = new JButton("<html><u>T</u>wo
lines</html>");
Ciao.