Skip to content

AquaTableUI drag and drop changes added table.setSelectionBackground and an infinite repaint() loop #47

@karlvr

Description

@karlvr

I have observed an infinite repaint loop in my app due to the code in AquaTableUI that (according to commit history) is related to drag and drop:

            if (!AquaColors.isPriority(table.getSelectionBackground())) {
                table.setSelectionBackground(null);
            }

and

            if (!AquaColors.isPriority(table.getSelectionBackground())) {
                Color c = AquaColors.CLEAR;
                if (isDropTarget) {
                    c = colors.getBackground(appearanceContext.withState(ACTIVE_DEFAULT).withSelected(true));
                } else if (isSelected) {
                    if (appearanceContext.getState() == ACTIVE_DEFAULT && isSelectionMuted) {
                        c = colors.getBackground(appearanceContext.withState(ACTIVE).withSelected(true));
                    } else {
                        c = colors.getBackground(appearanceContext.withSelected(true));
                    }
                }
                table.setSelectionBackground(c);
            }

This is because JTable.setSelectionBackground calls repaint(), and VAqua calls table.setSelectionBackground on every render.

I haven't found a good workaround for this yet. Perhaps we only need to change the selected background under some circumstances (in getRendererComponent), and we could only then undo it when necessary (in paintRenderedCell)?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions