Many modern applications combine title bar and menu bar (such as Chrome, VS Code, IntelliJ IDEA, MS Offer), how is this possible? Does the Windows system provide support for this effect or does the application implement all the title bar features entirely on its own?
I want to use JavaFX to achieve this effect, but it is not as simple as setting StageStyle.UNDECORATED and adding a mouse movement event.
For the Windows platform, double-clicking the title bar can switch the window between Maximize and Restore, press Alt+Space combination to open the title bar menu, there will be shadows or no shadows on the edge of the window according to the Windows system settings, and when dragging the window to move, only the window boundary is displayed instead of the window content according to the Windows system settings. In addition, Windows Aero Snap provides a switch between "Maximize", "Restore" and "Minimize" by pressing Win+↑ / Win+↓, and press Win+← / Win+→ to enter the snapped windows resize mode.
I found many JavaFX projects on the Internet for observation, so I found the FX-BorderlessScene library of the XR3Player project. It achieves a good effect, but it still does not achieve the full native effect. For example, after closing Aero Snap Window in the Windows system, it is still You can press Win+↑ to switch to maximize.
Is there a convenient and mature way to achieve a fully localized title bar? I would forego merging the title bar and menu bar if I had to do a huge amount of work to implement it myself.
IntelliJ IDEA developed in Java has almost 100% native title bar effect. How does it do it?
Use
JNAto call the native API ofMac,WindowsorLinuxto hide the title bar, and the followingdemoshows how to hide the title-bar on Windows and keep all Windows localized window decorations. There is no custom title-bar implementation provided here, you need to design it yourself.The pom.xml:
Demo: https://videos.ximinghui.org/230303_demo_running_on_win10.mp4
Note: The top 6px white bar question redirects Create window without titlebar, with resizable border and without bogus 6px white stripe