1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
|
// Defini les differents styles
private static void initStyle (StyleContext styles)
{ // definition du style pour le texte normal (brute)
javax.swing.text.Style defaut = styles.getStyle (StyleContext.DEFAULT_STYLE);
javax.swing.text.Style styleNormal = styles.addStyle("styleNormal", defaut);
StyleConstants.setFontFamily (styleNormal, "Courier");
StyleConstants.setFontSize (styleNormal, 11);
StyleConstants.setForeground(styleNormal, Color.black);
javax.swing.text.Style tmp = styles.addStyle("styleKeyWord", styleNormal);
// Ajout de la couleur blue et du style gras pour les mots cle
StyleConstants.setForeground(tmp, Color.blue);
StyleConstants.setBold(tmp, true);
tmp = styles.addStyle("styleOp", styleNormal);
// Ajout de la couleur rouge pour le style des operateurs
StyleConstants.setForeground(tmp, Color.red);
}
} |
Partager