I'm a beginner of JavaFX. Is there anyway to change the color of title bar. I just want to make the application all black. I have searched the JavaFX API, but I can't find any method to make it.
This is pretty much an OS dependent thing. The operating system gets to decide how titlebars and borders are displayed by default. However, it definitely can be done, if you are willing to venture into making your own title bar.
To start out, you will need to modify the application window's stage to StageStyle.UNDECORATED
. Then you will need to set up your own borders and title bar (complete with things like the title, minimize button, close button, etc.). You can then add the border pane as a scene into your application's stage, and that should render your custom titlebar then without the default Windows styling.
You can find an example implementation of that here: https://stackoverflow.com/a/9864496/2694511
Do note that because you are implementing your own titlebar, you will also lose the OS's default window drag behavior, so you will need to implement your own window-drag/window-move code. This answer might be able to help you with that: https://stackoverflow.com/a/11781291/2694511
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With