mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2026-02-11 22:47:13 -06:00
Tree: fixed truncated node text and too small painted non-wide node background if custom cell renderer sets icon, but not disabled icon, and tree is disabled (issue #640)
This commit is contained in:
@@ -310,6 +310,21 @@ public class FlatTreeUI
|
||||
tree.revalidate();
|
||||
tree.repaint();
|
||||
break;
|
||||
|
||||
case "enabled":
|
||||
// if default icons are not shown and the renderer is a subclass
|
||||
// of DefaultTreeCellRenderer, then invalidate tree node sizes
|
||||
// because the custom renderer may use an icon for enabled state
|
||||
// but none for disabled state
|
||||
if( !showDefaultIcons &&
|
||||
currentCellRenderer instanceof DefaultTreeCellRenderer &&
|
||||
currentCellRenderer.getClass() != DefaultTreeCellRenderer.class &&
|
||||
treeState != null )
|
||||
{
|
||||
treeState.invalidateSizes();
|
||||
updateSize();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -695,7 +710,7 @@ public class FlatTreeUI
|
||||
|
||||
if( rendererComponent instanceof JLabel ) {
|
||||
JLabel label = (JLabel) rendererComponent;
|
||||
Icon icon = label.getIcon();
|
||||
Icon icon = label.isEnabled() ? label.getIcon() : label.getDisabledIcon();
|
||||
imageOffset = (icon != null && label.getText() != null)
|
||||
? icon.getIconWidth() + Math.max( label.getIconTextGap() - 1, 0 )
|
||||
: 0;
|
||||
|
||||
Reference in New Issue
Block a user