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

JButton: wrong foreground for hovered default borderless button - FlatMacLightLaf #947

Closed
VISTALL opened this issue Dec 29, 2024 · 2 comments
Milestone

Comments

@VISTALL
Copy link

VISTALL commented Dec 29, 2024

Hovered default borderless button

{60600C95-EBFA-4151-B100-990D481BA6C1}

Hovered default button

{17C1F586-8357-4D02-8FF8-CC9BFC657517}

public class DefaultButtonBorderless {
    public static void main(String[] args) {
        SwingUtilities.invokeLater(() -> {
            FlatMacLightLaf.setup();

            JFrame frame = new JFrame();
            frame.setSize(500, 500);
            frame.setLocationByPlatform(true);
            frame.setLocationRelativeTo(null);

            JPanel panel = new JPanel();
            frame.add(panel);

            JButton anotherButton = new JButton("Skip");
            anotherButton.putClientProperty(FlatClientProperties.BUTTON_TYPE, FlatClientProperties.BUTTON_TYPE_BORDERLESS);

            JButton defaultButton = new JButton("Run");
            defaultButton.putClientProperty(FlatClientProperties.BUTTON_TYPE, FlatClientProperties.BUTTON_TYPE_BORDERLESS);
            frame.getRootPane().setDefaultButton(defaultButton);

            panel.add(anotherButton);
            panel.add(defaultButton);

            frame.setVisible(true);
        });
    }
}
@VISTALL VISTALL changed the title JButton: wrong foreground for hovered default borderless button for FlatMacLightLaf JButton: wrong foreground for hovered default borderless button - FlatMacLightLaf Dec 29, 2024
DevCharly added a commit that referenced this issue Jan 9, 2025
…toolBarButton` style default buttons (`JButton.isDefaultButton()` is `true`) (issue #947)
@DevCharly
Copy link
Collaborator

Thanks 👍

Fixed in latest 3.6-SNAPSHOT: https://github.com/JFormDesigner/FlatLaf#snapshots

The foreground and background colors were wrong for borderless and toolBarButton style default buttons (JButton.isDefaultButton() is true).

Left is old, right is fixed:

image

image

@DevCharly DevCharly added this to the 3.6 milestone Jan 9, 2025
@VISTALL
Copy link
Author

VISTALL commented Jan 9, 2025

Thanks!

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

2 participants