On Sat, 3 May 2025 08:35:15 GMT, Michael Strauß <mstra...@openjdk.org> wrote:
>> I imagine most people will want HeaderBar's leading node to be an app icon >> with the usual left-click context menu behaviour (i.e., at least restore, >> minimise, close), much like it is for DECORATED today. >> >> Today, you can add a bunch of icons to a stage with >> stage.getIcons().addAll(myLogoList)), and the window's header will contain a >> suitable icon; never too big, never too small. The developer doesn't worry >> about it. >> >> I really feel a utility to add an equivalent app icon to the HeaderBar, >> should be provided out-of-the-box, using the same logic. E.g., let HeaderBar >> choose the most suitable icon, and choose the correct size for the platform, >> and any padding, etc. Otherwise, the developer needs to think about it too >> much. >> >> A lot of this logic used by DECORATED, seems to be buried in WindowStage in >> terms of picking what icons to display in the title bar, etc. > > @credmond > I think we run the risk of overloading `HeaderBar` with too many narrow > features. Here are a few observations: > 1. Modern applications tend to not use program icons. Windows Explorer, > Calendar, Weather, Settings, and also Spotify or Chrome don't use it. Program > icons have become more of a Win32-era relict, and it's mostly applications > that use system-decorated windows that have it. > 2. Program icons are really only a thing on Windows. It doesn't seem to make > much sense to have a Windows-only API on a multi-platform toolkit. It > certainly doesn't work with macOS, as we have the traffic lights in front of > the leading node of the `HeaderBar`. > 3. It's very easy to create a program icon with standard JavaFX controls. > Since its size will never change, you can just use a static image with an > `ImageView` and a `ContextMenu`. JavaFX already supports multi-resolution > images out of the box (with the `@Nx` file name convention). > 4. If you choose to have a program icon, you most likely want it to align > nicely with the rest of your custom header bar. Even in apps that have a > program icon, it's not a one-size-fits-all (for example, the IntelliJ program > icon looks significantly different than a standard system-decorated program > icon). Once you start to customize the program icon, you're really better off > just using standard JavaFX controls to do the job. Thanks for the detailed reply @mstr2. I can't really argue with any of your points, I also agree. ------------- PR Comment: https://git.openjdk.org/jfx/pull/1605#issuecomment-2848565539