RSyntaxTextArea
RSyntaxTextArea copied to clipboard
Apply a theme to a RTextArea
Describe the solution you'd like
A theme org.fife.ui.rsyntaxtextarea.Theme can be assigned to a RSyntaxTextArea, but not to a RTextArea. We should be able to apply a subset of the Theme to RTextArea, so we keep all the components consistent from a LaF standpoint.
Are there any workarounds? Did that in my own code:
private static void apply(Theme t, RTextArea textArea) {
Color fg = UIManager.getColor("TextArea.foreground");
textArea.setForeground(fg);
textArea.setFont(t.baseFont);
textArea.setBackground(t.bgColor);
textArea.setCaretColor(t.caretColor);
textArea.setSelectedTextColor(t.selectionFG);
textArea.setSelectionColor(t.selectionBG);
textArea.setRoundedSelectionEdges(t.selectionRoundedEdges);
textArea.setCurrentLineHighlightColor(t.currentLineHighlight);
textArea.setFadeCurrentLineHighlight(t.fadeCurrentLineHighlight);
textArea.setMarginLineColor(t.marginLineColor);
textArea.setMarkAllHighlightColor(t.markAllHighlightColor);
}
It works with FlatLaf.