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

Change window title bar button icons #956

Closed
nitanmarcel opened this issue Jan 9, 2025 · 4 comments
Closed

Change window title bar button icons #956

nitanmarcel opened this issue Jan 9, 2025 · 4 comments

Comments

@nitanmarcel
Copy link

I'm using feather icons in my application and I would like to use some of their buttons as my minimize,maximize and close buttons

https://feathericons.com/?query=close

@VISTALL
Copy link

VISTALL commented Jan 9, 2025

Hello. Depends on this code

https://github.com/JFormDesigner/FlatLaf/blob/main/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatTitlePane.java#L348

You can override it via keys

"TitlePane.iconifyIcon"
"TitlePane.maximizeIcon"
"TitlePane.restoreIcon"
 "TitlePane.closeIcon"

There how laf set values

TitlePane.iconifyIcon = com.formdev.flatlaf.icons.FlatWindowIconifyIcon

@nitanmarcel
Copy link
Author

TitlePane.iconifyIcon

C

Hello. Depends on this code

https://github.com/JFormDesigner/FlatLaf/blob/main/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatTitlePane.java#L348

You can override it via keys

"TitlePane.iconifyIcon"
"TitlePane.maximizeIcon"
"TitlePane.restoreIcon"
 "TitlePane.closeIcon"

There how laf set values

TitlePane.iconifyIcon = com.formdev.flatlaf.icons.FlatWindowIconifyIcon

I've tried this but the hover hint dissapeared

`UIManager.put( "TitlePane.iconifyIcon", FlatSVGIcon("minimize.svg") )`

image

@VISTALL
Copy link

VISTALL commented Jan 9, 2025

All window icons impl used custom version of FlatWindowAbstractIcon. I think you need add custom variant with extending FlatWindowAbstractIcon and delegate paint (#paintIconAt1x()) to your svg icon

@DevCharly DevCharly changed the title Change toolbar buttons Change window title bar button icons Jan 15, 2025
@DevCharly
Copy link
Collaborator

The four icons are responsible for doing all necessary painting, including hover and pressed states.
This is slightly different to JButton, but gives those four icons full control. You could even paint round buttons:

image

You can either subclass FlatWindowAbstractIcon, which paints hover/pressed background, or implement it in your own icon class. The hover and pressed states can be retrieved from the component passed to Icon.paintIcon(Component c, Graphics g, int x, int y).

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

No branches or pull requests

3 participants