/** * Set the font for all token types. * * @param textArea The text area to modify. * @param font The font to use. */ public static void setFont(RSyntaxTextArea textArea, Font font) { if (font != null) { SyntaxScheme ss = textArea.getSyntaxScheme(); ss = (SyntaxScheme) ss.clone(); for (int i = 0; i < ss.getStyleCount(); i++) { if (ss.getStyle(i) != null) { ss.getStyle(i).font = font; } } textArea.setSyntaxScheme(ss); textArea.setFont(font); } }
public Object clone() { SyntaxScheme shcs = null; shcs = (SyntaxScheme) super.clone(); shcs.styles = new Style[SquirrelTokenMarker.getNumTokenTypes()]; for (int i = 0; i < SquirrelTokenMarker.getNumTokenTypes(); i++) { Style s = styles[i]; if (s != null) { shcs.styles[i] = (Style) s.clone(); } } return shcs; }