How to left align JFrame Title text between different OSs

烈酒焚心 提交于 2019-12-24 00:15:31

问题


It looks like the OS is controlling the whole JFrame title bar. I tried using:

UIManager.setLookAndFeel()

To change the Look and Feel, but it doesn't seem to affect the title bar.

On my Windows machine the default is left aligned, but on my Linux machine it's centered, and somehow, I'd like to try to always show the title text left aligned.

I saw one example where they basically built every element of the title bar from scratch, and I'd rather not go there.

Is there any other way to do it?

Thanks!


回答1:


If the L&F supports window decorations, you can use setWindowDecorationStyle(). A complete example is cited here in UIManager Defaults.



来源:https://stackoverflow.com/questions/19920833/how-to-left-align-jframe-title-text-between-different-oss

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!