mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2025-12-06 22:10:54 +03:00
FlatComponents2Test: allow enabling tree editing
This commit is contained in:
@@ -386,6 +386,12 @@ public class FlatComponents2Test
|
||||
tree.putClientProperty( FlatClientProperties.TREE_PAINT_SELECTION, paintSelection );
|
||||
}
|
||||
|
||||
private void treeEditableChanged() {
|
||||
boolean editable = treeEditableCheckBox.isSelected();
|
||||
for( JTree tree : allTrees )
|
||||
tree.setEditable( editable );
|
||||
}
|
||||
|
||||
private void treeMouseClicked( MouseEvent e ) {
|
||||
JTree tree = (JTree) e.getSource();
|
||||
int x = e.getX();
|
||||
@@ -475,6 +481,7 @@ public class FlatComponents2Test
|
||||
treeRendererComboBox = new JComboBox<>();
|
||||
treeWideSelectionCheckBox = new JCheckBox();
|
||||
treePaintSelectionCheckBox = new JCheckBox();
|
||||
treeEditableCheckBox = new JCheckBox();
|
||||
JPanel tableOptionsPanel = new JPanel();
|
||||
JLabel autoResizeModeLabel = new JLabel();
|
||||
autoResizeModeField = new JComboBox<>();
|
||||
@@ -754,10 +761,11 @@ public class FlatComponents2Test
|
||||
treeOptionsPanel.setLayout(new MigLayout(
|
||||
"hidemode 3",
|
||||
// columns
|
||||
"[fill]",
|
||||
"[left]",
|
||||
// rows
|
||||
"[]" +
|
||||
"[]0" +
|
||||
"[]0" +
|
||||
"[]"));
|
||||
|
||||
//---- treeRendererLabel ----
|
||||
@@ -786,6 +794,11 @@ public class FlatComponents2Test
|
||||
treePaintSelectionCheckBox.setSelected(true);
|
||||
treePaintSelectionCheckBox.addActionListener(e -> treePaintSelectionChanged());
|
||||
treeOptionsPanel.add(treePaintSelectionCheckBox, "cell 0 2");
|
||||
|
||||
//---- treeEditableCheckBox ----
|
||||
treeEditableCheckBox.setText("editable");
|
||||
treeEditableCheckBox.addActionListener(e -> treeEditableChanged());
|
||||
treeOptionsPanel.add(treeEditableCheckBox, "cell 0 3");
|
||||
}
|
||||
add(treeOptionsPanel, "cell 2 4");
|
||||
|
||||
@@ -905,6 +918,7 @@ public class FlatComponents2Test
|
||||
private JComboBox<String> treeRendererComboBox;
|
||||
private JCheckBox treeWideSelectionCheckBox;
|
||||
private JCheckBox treePaintSelectionCheckBox;
|
||||
private JCheckBox treeEditableCheckBox;
|
||||
private JComboBox<String> autoResizeModeField;
|
||||
private JComboBox<String> sortIconPositionComboBox;
|
||||
private JCheckBox showHorizontalLinesCheckBox;
|
||||
|
||||
@@ -317,8 +317,8 @@ new FormModel {
|
||||
} )
|
||||
add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) {
|
||||
"$layoutConstraints": "hidemode 3"
|
||||
"$columnConstraints": "[fill]"
|
||||
"$rowConstraints": "[][]0[]"
|
||||
"$columnConstraints": "[left]"
|
||||
"$rowConstraints": "[][]0[]0[]"
|
||||
} ) {
|
||||
name: "treeOptionsPanel"
|
||||
"border": new javax.swing.border.TitledBorder( "JTree Control" )
|
||||
@@ -367,6 +367,16 @@ new FormModel {
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 0 2"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JCheckBox" ) {
|
||||
name: "treeEditableCheckBox"
|
||||
"text": "editable"
|
||||
auxiliary() {
|
||||
"JavaCodeGenerator.variableLocal": false
|
||||
}
|
||||
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "treeEditableChanged", false ) )
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 0 3"
|
||||
} )
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 2 4"
|
||||
} )
|
||||
|
||||
Reference in New Issue
Block a user