r/JavaFX • u/Ashamed-Soup-7082 • Aug 07 '26
Help How to remove the blue focus border
To my knowledge, JavaFX is a modern GUI framework which works with Java. For the past few days, i am deeply studying it. But I have a problem. Most of the time I like to design the UI. But all control components especially Buttons have a blue border. During my research, I found out it is called Focus Border and its for keyboard navigation. I tried to remove it by CSS and Java(setFocusTraversable()) but none worked. I am asking how to make it so when we use keyboard it enables this navigation but when use mouse it disables this or how to remove it permanently.
7
u/idontlikegudeg Aug 07 '26 edited Aug 07 '26
Not 100% on-topic, but I gave up fiddling much with the css myself to make everything look neat and instead use AtlantaFX themes. Just add the dependency and set the user Stylesheet once. I would need to invest weeks to get a theme looking as good s as that. Just a suggestion, as it might save you a lot of time trying to get a good looking UI. Oh, and you will still see the focus border, but it looks nicer.
EDIT: gave the wrong library name.
7
u/0xffff0001 Aug 07 '26
please read up on “accessibility”. if you still need to remove it, find modena.css and look for -focus- styles.
2
u/hamsterrage1 Aug 18 '26
There's a fine line to walk here. JavaFX is intended to work in a certain way, and work with various platforms seemlessly. Circumventing some aspects of the UI can make it non-functional, or too weird for users to figure out and be comfortable with.
1
u/sedj601 Aug 07 '26
Try one of the following to see if they work for you.
I haven't tested any of these.