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

Tree refresh causes content to be truncated, v3.0 #640

Closed
Corionis opened this issue Jan 12, 2023 · 6 comments
Closed

Tree refresh causes content to be truncated, v3.0 #640

Corionis opened this issue Jan 12, 2023 · 6 comments
Milestone

Comments

@Corionis
Copy link

When a JTree control is refreshed the content is truncated with trailing ellipses (...). The tree is in a JSplitPane that is significantly wider.

The previous version 2.4 worked correctly. Nothing else has changed.

Screenshot from 2023-01-12 16-33-10

FlatLaf 3.0 on Linux Mint latest running Java 8.

@DevCharly
Copy link
Collaborator

Hmm, don't have this effect here.
Could be related to commit b736502, which hides default node icons (closed and opened folders).

Did you set Tree.showDefaultIcons to true to show them after the update to FlatLaf 3.0?
Or is it a custom tree renderer?

Does it work if you add following?

UIManager.put( "Tree.showDefaultIcons", true );

@Corionis
Copy link
Author

No, I had not set Tree.showDefaultIcons to true.
No, not a custom tree renderer, but a custom tree cell renderer.

Yes, it works after adding that line! Thank you!! (Gee, that was easy).

@DevCharly
Copy link
Collaborator

Still trying to understand why this happens...

No, not a custom tree renderer, but a custom tree cell renderer.

In which method do you set the icon in your renderer?

@Corionis
Copy link
Author

It's done in:

public Component getTreeCellRendererComponent(JTree tree, Object value, boolean sel, boolean expanded, boolean leaf, int row, boolean hasFocus)

after calling super.getTreeCellRendererComponent(...)

@Corionis
Copy link
Author

Corionis commented Jan 13, 2023

@DevCharly DevCharly reopened this Feb 2, 2023
DevCharly added a commit that referenced this issue Feb 5, 2023
…ackground if custom cell renderer sets icon, but not disabled icon, and tree is disabled (issue #640)
@DevCharly
Copy link
Collaborator

Found the reason for this behavior. It is because you disable the tree while updating the table model (which is fine), but the custom tree cell renderer does not have a icon for disabled state. This results in too small nodes, which were not updated when re-enabling tree.

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

@DevCharly DevCharly added this to the 3.1 milestone Feb 5, 2023
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