Tree: Fixed missing custom closed/opened/leaf icons of a custom DefaultTreeCellRenderer. (issue #653; regression since implementing PR #609 in FlatLaf 3.0)

This commit is contained in:
Karl Tauber
2023-03-02 23:06:35 +01:00
parent 465798ee3d
commit 2f5c54bb49
4 changed files with 42 additions and 3 deletions

View File

@@ -439,6 +439,11 @@ public class FlatComponents2Test
tree.setCellRenderer( new TestDefaultTreeCellRenderer() );
break;
case "defaultWithIcons":
for( JTree tree : trees )
tree.setCellRenderer( new TestDefaultWithIconsTreeCellRenderer() );
break;
case "defaultWithIcon":
for( JTree tree : trees )
tree.setCellRenderer( new TestDefaultWithIconTreeCellRenderer() );
@@ -960,6 +965,7 @@ public class FlatComponents2Test
treeRendererComboBox.setModel(new DefaultComboBoxModel<>(new String[] {
"default",
"defaultSubclass",
"defaultWithIcons",
"defaultWithIcon",
"label",
"swingxDefault",
@@ -1612,6 +1618,18 @@ public class FlatComponents2Test
}
}
//---- class TestDefaultWithIconsTreeCellRenderer -------------------------
private static class TestDefaultWithIconsTreeCellRenderer
extends TestDefaultTreeCellRenderer
{
public TestDefaultWithIconsTreeCellRenderer() {
setLeafIcon( UIManager.getIcon( "FileView.floppyDriveIcon" ) );
setClosedIcon( UIManager.getIcon( "FileView.hardDriveIcon" ) );
setOpenIcon( UIManager.getIcon( "FileView.computerIcon" ) );
}
}
//---- class TestDefaultWithIconTreeCellRenderer --------------------------
private static class TestDefaultWithIconTreeCellRenderer

View File

@@ -411,6 +411,7 @@ new FormModel {
selectedItem: "default"
addElement( "default" )
addElement( "defaultSubclass" )
addElement( "defaultWithIcons" )
addElement( "defaultWithIcon" )
addElement( "label" )
addElement( "swingxDefault" )