Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Window decorations: Title bar customizing #613

Merged
merged 2 commits into from
Dec 3, 2022
Merged

Conversation

DevCharly
Copy link
Collaborator

(work in progress)

Purpose of this PR is to improve customizing of title bar in FlatLaf window decorations (usually used on Windows 10/11).

Done

  • hide window title, iconify, maximize and close buttons
  • hide window icon (since FlatLaf 2.0)
  • change title bar background/foreground (since FlatLaf 1.1.2)

To do

  • fullWindowContent option (similar to macOS https://www.formdev.com/flatlaf/macos/#full_window_content)
  • optionally place iconify, maximize and close buttons on left side (in reverse order), useful if fullWindowContent is enabled
  • specify areas where the user can click-and-drag window (if fullWindowContent is enabled)
  • TBD

How to

Hide window icon or title

frameOrDialog.getRootPane().putClientProperty( FlatClientProperties.TITLE_BAR_SHOW_ICON, false );
frameOrDialog.getRootPane().putClientProperty( FlatClientProperties.TITLE_BAR_SHOW_TITLE, false );

Hide iconify, maximize/restore or close button

frame.getRootPane().putClientProperty( FlatClientProperties.TITLE_BAR_SHOW_ICONIFFY, false );
frame.getRootPane().putClientProperty( FlatClientProperties.TITLE_BAR_SHOW_MAXIMIZE, false );
frameOrDialog.getRootPane().putClientProperty( FlatClientProperties.TITLE_BAR_SHOW_CLOSE, false );

Change title bar background/foreground

frameOrDialog.getRootPane().putClientProperty( FlatClientProperties.TITLE_BAR_BACKGROUND, Color.green );
frameOrDialog.getRootPane().putClientProperty( FlatClientProperties.TITLE_BAR_FOREGROUND, Color.blue );

…that are used by Windows 10/11 in WM_NCHITTEST to identify special areas
@DevCharly DevCharly added this to the 3.0 milestone Nov 16, 2022
@DevCharly DevCharly mentioned this pull request Nov 16, 2022
@xhzco
Copy link

xhzco commented Nov 23, 2022

Does it support Windows XP and Windows 7?

@DevCharly
Copy link
Collaborator Author

Does it support Windows XP and Windows 7?

No, Windows 10 and later

@DevCharly DevCharly marked this pull request as ready for review December 3, 2022 18:19
@DevCharly DevCharly merged commit d286550 into main Dec 3, 2022
@DevCharly
Copy link
Collaborator Author

Merged the PR for FlatLaf 3.0.

Will implement the "to dos" listed in above post in a later version...

@DevCharly DevCharly deleted the title-bar-customizing branch July 1, 2023 15:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants