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

customization example doesn't seem to have an effect #257

Closed
jonathanlocke opened this issue Feb 11, 2021 · 8 comments
Closed

customization example doesn't seem to have an effect #257

jonathanlocke opened this issue Feb 11, 2021 · 8 comments
Milestone

Comments

@jonathanlocke
Copy link

the colors of JTabbedPane can be customized with this:

    UIManager.put("TabbedPane.minimumTabWidth", 150);
    UIManager.put("TabbedPane.background", DARK_GRAY);
    UIManager.put("TabbedPane.foreground", DARK_YELLOW);
    **UIManager.put("TabbedPane.selectedBackground", CHERRY);**
    UIManager.put("TabbedPane.hoverColor", DARK_GRAY.);
    UIManager.put("TabbedPane.underlineColor", DARK_YELLOW);

and most of it works, but the line in bold (which is on the example page for how to customize flatlaf) doesn't seem to have any effect. selectedForeground doesn't seem to work either. i'm using flatlaf 0.45. thanks!

Jon
@DevCharly
Copy link
Collaborator

Hmm, just tried. TabbedPane.selectedBackground works for me.

Is it possible that the tabbed pane was focused in your test?
Then TabbedPane.focusColor is used for the selected (focused) tab background.

UIManager.put("TabbedPane.focusColor", Color.red);

TabbedPane.selectedForeground does indeed not work in your case
because TabbedPane.foreground is also set.
This is a bug.

To workaround (until fixed in FlatLaf), use a ColorUIResource for TabbedPane.foreground:

UIManager.put("TabbedPane.foreground", new ColorUIResource(WHITE));

DevCharly added a commit that referenced this issue Feb 11, 2021
… when `TabbedPane.foreground` has also custom color (issue #257)
@DevCharly DevCharly added this to the 1.0 milestone Feb 11, 2021
@DevCharly
Copy link
Collaborator

TabbedPane.selectedForeground is now fixed in main branch.

@jonathanlocke
Copy link
Author

jonathanlocke commented Feb 14, 2021

Thanks very much DevCharly! Open Source rocks, doesn't it?

@jonathanlocke
Copy link
Author

Is it possible that there's a problem for the background / selectedBackground as well? I see that one too now. I tried your ColorUIResource workaround for that pair of colors and that didn't seem to do the trick.

@ju-gem
Copy link

ju-gem commented Feb 18, 2021

Hi,
I also have problems with TabbedPane.selectedBackground.
UIManager.put("TabbedPane.selectedBackground", new Color(242, 224, 232));
doesn't have any effect. When not focused, the color shows, but as soon as the focus is set on my application window, the background is default-blue again. May be a bug?
Best regards,
ju-gem

@DevCharly
Copy link
Collaborator

When not focused, the color shows, but as soon as the focus is set on my application window, the background is default-blue again. May be a bug?

@ju-gem no, that's exactly how it should work.

  • TabbedPane.focusColor is used as background for selected tab if tabbedpane component itself has focus
  • TabbedPane.selectedBackground is used if any other component has focus

If you don't want that your tabbedpane can be focused, then use:

tabbedPane.setFocusable( false );

@ju-gem
Copy link

ju-gem commented Feb 19, 2021

Alright, that makes sense. Thanks @DevCharly!

@DevCharly
Copy link
Collaborator

@jonathanlocke the problem with TabbedPane.selectedForeground is fixed in FlatLaf 1.0.

Can't find a problem with TabbedPane.selectedBackground. See also my previous post.

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