- Fixed missing tree lines (if enabled) for wide-selected rows. (issue #598)
- Fixed scaling of tree lines and fixed alignment to expand/collapse arrows.
- Removed support for dashed tree lines. `Tree.lineTypeDashed` is now ignored.
This commit is contained in:
Karl Tauber
2022-11-01 10:12:49 +01:00
parent 2bfbc9dc12
commit ef21efecf5
4 changed files with 196 additions and 11 deletions

View File

@@ -473,6 +473,22 @@ public class FlatComponents2Test
tree.putClientProperty( FlatClientProperties.TREE_PAINT_SELECTION, paintSelection );
}
private void treePaintLinesChanged() {
boolean paintLines = treePaintLinesCheckBox.isSelected();
UIManager.put( "Tree.paintLines", paintLines ? true : null );
for( JTree tree : allTrees )
tree.updateUI();
treeRedLinesCheckBox.setEnabled( paintLines );
}
private void treeRedLinesChanged() {
boolean redLines = treeRedLinesCheckBox.isSelected();
UIManager.put( "Tree.hash", redLines ? Color.red : null );
for( JTree tree : allTrees )
tree.updateUI();
}
private void treeEditableChanged() {
boolean editable = treeEditableCheckBox.isSelected();
for( JTree tree : allTrees )
@@ -575,6 +591,8 @@ public class FlatComponents2Test
treeRendererComboBox = new JComboBox<>();
treeWideSelectionCheckBox = new JCheckBox();
treePaintSelectionCheckBox = new JCheckBox();
treePaintLinesCheckBox = new JCheckBox();
treeRedLinesCheckBox = new JCheckBox();
treeEditableCheckBox = new JCheckBox();
JPanel tableOptionsPanel = new JPanel();
JLabel autoResizeModeLabel = new JLabel();
@@ -917,6 +935,7 @@ public class FlatComponents2Test
"[]" +
"[]0" +
"[]0" +
"[]0" +
"[]"));
//---- treeRendererLabel ----
@@ -946,10 +965,21 @@ public class FlatComponents2Test
treePaintSelectionCheckBox.addActionListener(e -> treePaintSelectionChanged());
treeOptionsPanel.add(treePaintSelectionCheckBox, "cell 0 2");
//---- treePaintLinesCheckBox ----
treePaintLinesCheckBox.setText("paint lines");
treePaintLinesCheckBox.addActionListener(e -> treePaintLinesChanged());
treeOptionsPanel.add(treePaintLinesCheckBox, "cell 0 3");
//---- treeRedLinesCheckBox ----
treeRedLinesCheckBox.setText("red lines");
treeRedLinesCheckBox.setEnabled(false);
treeRedLinesCheckBox.addActionListener(e -> treeRedLinesChanged());
treeOptionsPanel.add(treeRedLinesCheckBox, "cell 0 3");
//---- treeEditableCheckBox ----
treeEditableCheckBox.setText("editable");
treeEditableCheckBox.addActionListener(e -> treeEditableChanged());
treeOptionsPanel.add(treeEditableCheckBox, "cell 0 3");
treeOptionsPanel.add(treeEditableCheckBox, "cell 0 4");
}
add(treeOptionsPanel, "cell 0 4 4 1");
@@ -1083,6 +1113,8 @@ public class FlatComponents2Test
private JComboBox<String> treeRendererComboBox;
private JCheckBox treeWideSelectionCheckBox;
private JCheckBox treePaintSelectionCheckBox;
private JCheckBox treePaintLinesCheckBox;
private JCheckBox treeRedLinesCheckBox;
private JCheckBox treeEditableCheckBox;
private JComboBox<String> autoResizeModeField;
private JComboBox<String> sortIconPositionComboBox;

View File

@@ -1,4 +1,4 @@
JFDML JFormDesigner: "7.0.5.0.404" Java: "17.0.2" encoding: "UTF-8"
JFDML JFormDesigner: "8.0.0.0.194" Java: "17.0.2" encoding: "UTF-8"
new FormModel {
contentType: "form/swing"
@@ -395,7 +395,7 @@ new FormModel {
add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) {
"$layoutConstraints": "hidemode 3"
"$columnConstraints": "[left]"
"$rowConstraints": "[][]0[]0[]"
"$rowConstraints": "[][]0[]0[]0[]"
} ) {
name: "treeOptionsPanel"
"border": new javax.swing.border.TitledBorder( "JTree Control" )
@@ -445,6 +445,27 @@ new FormModel {
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 2"
} )
add( new FormComponent( "javax.swing.JCheckBox" ) {
name: "treePaintLinesCheckBox"
"text": "paint lines"
auxiliary() {
"JavaCodeGenerator.variableLocal": false
}
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "treePaintLinesChanged", false ) )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 3"
} )
add( new FormComponent( "javax.swing.JCheckBox" ) {
name: "treeRedLinesCheckBox"
"text": "red lines"
"enabled": false
auxiliary() {
"JavaCodeGenerator.variableLocal": false
}
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "treeRedLinesChanged", false ) )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 3"
} )
add( new FormComponent( "javax.swing.JCheckBox" ) {
name: "treeEditableCheckBox"
"text": "editable"
@@ -453,7 +474,7 @@ new FormModel {
}
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "treeEditableChanged", false ) )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 3"
"value": "cell 0 4"
} )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 4 4 1"