use of com.github.weisj.darklaf.extensions.rsyntaxarea.DarklafRSyntaxTheme in project jmeter by apache.
the class JSyntaxTextArea method applyTheme.
/**
* Apply XML Theme to syntax text area
* @param jSyntaxTextArea
*/
private static void applyTheme(JSyntaxTextArea jSyntaxTextArea) {
final boolean isDarklafTheme = LookAndFeelCommand.isDarklafTheme();
final Theme theme = isDarklafTheme ? new DarklafRSyntaxTheme(jSyntaxTextArea) : DEFAULT_THEME;
if (theme != null) {
theme.apply(jSyntaxTextArea);
Font font = jSyntaxTextArea.getFont();
float scale = JMeterUIDefaults.INSTANCE.getScale();
if (Math.abs(scale - 1.0f) > 0.01) {
font = font.deriveFont(font.getSize2D() * scale);
jSyntaxTextArea.setFont(font);
}
}
if (!isDarklafTheme) {
// Darklaf themes provide a custom background color for editors, so we don't overwrite it.
Color color = UIManager.getColor("TextArea.background");
if (color != null) {
// Pretend syntax textarea theme was designed for the current LaF
jSyntaxTextArea.setBackground(color);
}
}
}
Aggregations