Tree: hide default closed/opened/leaf icons by default

This commit is contained in:
Karl Tauber
2022-11-14 14:21:28 +01:00
parent 2be2dae3d6
commit b736502c27
11 changed files with 49 additions and 2 deletions

View File

@@ -1399,6 +1399,7 @@ Tree.selectionInactiveBackground #0f2a3d HSL 205 61 15 javax.swing.plaf.Co
Tree.selectionInactiveForeground #bbbbbb HSL 0 0 73 javax.swing.plaf.ColorUIResource [UI]
Tree.selectionInsets 0,0,0,0 javax.swing.plaf.InsetsUIResource [UI]
Tree.showCellFocusIndicator false
Tree.showDefaultIcons false
Tree.textBackground #46494b HSL 204 3 28 javax.swing.plaf.ColorUIResource [UI]
Tree.textForeground #bbbbbb HSL 0 0 73 javax.swing.plaf.ColorUIResource [UI]
Tree.timeFactor 1000

View File

@@ -1404,6 +1404,7 @@ Tree.selectionInactiveBackground #d3d3d3 HSL 0 0 83 javax.swing.plaf.Co
Tree.selectionInactiveForeground #000000 HSL 0 0 0 javax.swing.plaf.ColorUIResource [UI]
Tree.selectionInsets 0,0,0,0 javax.swing.plaf.InsetsUIResource [UI]
Tree.showCellFocusIndicator false
Tree.showDefaultIcons false
Tree.textBackground #ffffff HSL 0 0 100 javax.swing.plaf.ColorUIResource [UI]
Tree.textForeground #000000 HSL 0 0 0 javax.swing.plaf.ColorUIResource [UI]
Tree.timeFactor 1000

View File

@@ -1409,6 +1409,7 @@ Tree.selectionInactiveBackground #464646 HSL 0 0 27 javax.swing.plaf.Co
Tree.selectionInactiveForeground #dddddd HSL 0 0 87 javax.swing.plaf.ColorUIResource [UI]
Tree.selectionInsets 0,0,0,0 javax.swing.plaf.InsetsUIResource [UI]
Tree.showCellFocusIndicator false
Tree.showDefaultIcons false
Tree.textBackground #282828 HSL 0 0 16 javax.swing.plaf.ColorUIResource [UI]
Tree.textForeground #dddddd HSL 0 0 87 javax.swing.plaf.ColorUIResource [UI]
Tree.timeFactor 1000

View File

@@ -1413,6 +1413,7 @@ Tree.selectionInactiveBackground #dcdcdc HSL 0 0 86 javax.swing.plaf.Co
Tree.selectionInactiveForeground #262626 HSL 0 0 15 javax.swing.plaf.ColorUIResource [UI]
Tree.selectionInsets 0,0,0,0 javax.swing.plaf.InsetsUIResource [UI]
Tree.showCellFocusIndicator false
Tree.showDefaultIcons false
Tree.textBackground #ffffff HSL 0 0 100 javax.swing.plaf.ColorUIResource [UI]
Tree.textForeground #262626 HSL 0 0 15 javax.swing.plaf.ColorUIResource [UI]
Tree.timeFactor 1000

View File

@@ -1450,6 +1450,7 @@ Tree.selectionInactiveBackground #888888 HSL 0 0 53 javax.swing.plaf.Co
Tree.selectionInactiveForeground #ffffff HSL 0 0 100 javax.swing.plaf.ColorUIResource [UI]
Tree.selectionInsets 0,0,0,0 javax.swing.plaf.InsetsUIResource [UI]
Tree.showCellFocusIndicator false
Tree.showDefaultIcons false
Tree.textBackground #fff0ff HSL 300 100 97 javax.swing.plaf.ColorUIResource [UI]
Tree.textForeground #ff0000 HSL 0 100 50 javax.swing.plaf.ColorUIResource [UI]
Tree.timeFactor 1000

View File

@@ -495,6 +495,13 @@ public class FlatComponents2Test
tree.setEditable( editable );
}
private void showDefaultIcons() {
boolean showDefaultIcons = showDefaultIconsCheckBox.isSelected();
UIManager.put( "Tree.showDefaultIcons", showDefaultIcons ? true : null );
for( JTree tree : allTrees )
tree.updateUI();
}
private void treeMouseClicked( MouseEvent e ) {
JTree tree = (JTree) e.getSource();
int x = e.getX();
@@ -594,6 +601,7 @@ public class FlatComponents2Test
treePaintLinesCheckBox = new JCheckBox();
treeRedLinesCheckBox = new JCheckBox();
treeEditableCheckBox = new JCheckBox();
showDefaultIconsCheckBox = new JCheckBox();
JPanel tableOptionsPanel = new JPanel();
JLabel autoResizeModeLabel = new JLabel();
autoResizeModeField = new JComboBox<>();
@@ -754,7 +762,6 @@ public class FlatComponents2Test
//---- tree1 ----
tree1.setShowsRootHandles(true);
tree1.setEditable(true);
tree1.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
@@ -980,6 +987,11 @@ public class FlatComponents2Test
treeEditableCheckBox.setText("editable");
treeEditableCheckBox.addActionListener(e -> treeEditableChanged());
treeOptionsPanel.add(treeEditableCheckBox, "cell 0 4");
//---- showDefaultIconsCheckBox ----
showDefaultIconsCheckBox.setText("show default icons");
showDefaultIconsCheckBox.addActionListener(e -> showDefaultIcons());
treeOptionsPanel.add(showDefaultIconsCheckBox, "cell 0 4");
}
add(treeOptionsPanel, "cell 0 4 4 1");
@@ -1116,6 +1128,7 @@ public class FlatComponents2Test
private JCheckBox treePaintLinesCheckBox;
private JCheckBox treeRedLinesCheckBox;
private JCheckBox treeEditableCheckBox;
private JCheckBox showDefaultIconsCheckBox;
private JComboBox<String> autoResizeModeField;
private JComboBox<String> sortIconPositionComboBox;
private JCheckBox showHorizontalLinesCheckBox;

View File

@@ -184,7 +184,6 @@ new FormModel {
add( new FormComponent( "javax.swing.JTree" ) {
name: "tree1"
"showsRootHandles": true
"editable": true
auxiliary() {
"JavaCodeGenerator.variableLocal": false
}
@@ -476,6 +475,16 @@ new FormModel {
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 4"
} )
add( new FormComponent( "javax.swing.JCheckBox" ) {
name: "showDefaultIconsCheckBox"
"text": "show default icons"
auxiliary() {
"JavaCodeGenerator.variableLocal": false
}
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "showDefaultIcons", false ) )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 4"
} )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 4 4 1"
} )