Home > front end >  Change accent color of component while using FlatLaf
Change accent color of component while using FlatLaf

Time:12-04

I am using FlatLaf L&F for my Java Swing project and I am wondering how can I change the accent color of components. For example, I know that I can make buttons round using the code below:

button.putClientProperty( "JButton.buttonType", "roundRect" );

But I do not know how to change the accent color (by default it is blue). I was using the FlatLaf theme editor in Eclipse but now I am working in NetBeans and that theme editor does not work for some reason. You can see the picture below. I want to change the blue color to green. Thank you!

enter image description here

CodePudding user response:

You can change accent color using this code:

FlatLaf.setGlobalExtraDefaults( Collections.singletonMap( "@accentColor", "#f00" ) );
FlatIntelliJLaf.setup();

Here you can see more info about accent colors

  • Related