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

Title pane improvements (Windows 10 only) #268

Merged
merged 4 commits into from
Mar 14, 2021
Merged

Conversation

DevCharly
Copy link
Collaborator

This PR brings some improvements to the title pane used in (native) custom window decorations:

Right aligned components in title pane with embedded menu bar

A usual way to add a component to the right side of the menu bar is to first add a horizontal glue component (Box.createHorizontalGlue()) and then the own component. In a non-embedded menu bar it looks like this:

image

With this PR, this also works for embedded menu bars:

image

Example for adding own component to right side of menu bar:

JButton myButton = new JButton();
myButton.setIcon( new FlatSVGIcon( "myicon.svg" ) );
myButton.putClientProperty( "JButton.buttonType", "toolBarButton" );
myButton.setFocusable( false );
myMenuBar.add( Box.createHorizontalGlue() );
myMenuBar.add( myButton );

Window title now centered within window bounds

New: title centered between window bounds:

image

Old: title centered between menu bar and window buttons:

image

Left aligned title with embedded menu bar

Optionally left align title when menu bar is embedded:

image

Enable with:

UIManager.put( "TitlePane.centerTitleIfMenuBarEmbedded", false );

Center title

Optionally center title when menu bar is not embedded:

image

Enable with:

UIManager.put( "TitlePane.centerTitle", true );

Unified backgrounds

To give your app an even more modern look, you can now use unified backgrounds for window title bar, menu bar and main content. This is similar to what IntelliJ IDEA does.

image

Enable with:

UIManager.put( "TitlePane.unifiedBackground", true );

You can try this in the FlatLafDemo app with "Options > Unified Title Bar".

- support customizing of window title alignment: left aligned or centered (default is left without embedded menubar and centered with embedded menubar)
- improved centering of window title with embedded menubar (issue #252)
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.

1 participant