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

JCheckBox opaque = false ignored #77

Closed
coreequip opened this issue Mar 14, 2020 · 4 comments
Closed

JCheckBox opaque = false ignored #77

coreequip opened this issue Mar 14, 2020 · 4 comments
Milestone

Comments

@coreequip
Copy link

Hi JFormDesigner-Team (hallo Karl),

first thanks for the great FlatLaf - its awesome!

I just switched from Darcula to FlatLaf and now I had to realize that there is a problem with the "opaque-ness" of the JCheckBox component. In my case I use a JScrollPane with a custom JViewport to draw a background image behind the list elements. As a ListCellRenderer I use JCheckBoxes with opaque = false. It worked well with all other LAFs but FlatLaf shows a solid (opaque) background color. The expected behavior is a transparent background of the JCheckBox' text label.

class TrackListCellRenderer implements ListCellRenderer<TrackListBean> {

    private JCheckBox checkBox
    TrackListCellRenderer() {
        checkBox = new JCheckBox()
    }

    @Override
    Component getListCellRendererComponent(JList<? extends TrackListBean> list, TrackListBean value,
                                           int index, boolean isSelected, boolean cellHasFocus) {

        // make sure to have it opaque when selected
        checkBox.opaque = isSelected

        // ...
}

(this is groovy code)

Thanks a lot.

@Chrriis
Copy link
Contributor

Chrriis commented May 5, 2020

In dark mode, I noticed a table where one column does not respect the background color: it actually has a checkbox renderer. I would need to investigate when time allows, but it might well be linked to this issue.

@Chrriis
Copy link
Contributor

Chrriis commented May 6, 2020

Using this one-class test case (warning, nasty look and feel stuff to paint cell background):
TableTest.zip

We get on Windows:
TableBackground1

and with FlatLaf:
TableBackground2

DevCharly added a commit that referenced this issue May 12, 2020
…box is used as table cell renderer (issue #77)

this fix replaces/improves fix made in commit 3ba8133
@DevCharly
Copy link
Collaborator

Sorry for the late response. This should be fixed in master branch now. Hope it works 😉

@DevCharly DevCharly added this to the 0.35 milestone May 12, 2020
@Chrriis
Copy link
Contributor

Chrriis commented May 13, 2020

Works fine! Thanks!

DevCharly added a commit that referenced this issue Jan 20, 2021
…ound color is different to default background color, even if component is not opaque (which is the default). This paints selection if using the component as cell renderer a Table, Tree or List (better fix for #77)
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