mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2025-12-06 14:00:55 +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 );
|
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 ) {
|
private void treeMouseClicked( MouseEvent e ) {
|
||||||
JTree tree = (JTree) e.getSource();
|
JTree tree = (JTree) e.getSource();
|
||||||
int x = e.getX();
|
int x = e.getX();
|
||||||
@@ -475,6 +481,7 @@ public class FlatComponents2Test
|
|||||||
treeRendererComboBox = new JComboBox<>();
|
treeRendererComboBox = new JComboBox<>();
|
||||||
treeWideSelectionCheckBox = new JCheckBox();
|
treeWideSelectionCheckBox = new JCheckBox();
|
||||||
treePaintSelectionCheckBox = new JCheckBox();
|
treePaintSelectionCheckBox = new JCheckBox();
|
||||||
|
treeEditableCheckBox = new JCheckBox();
|
||||||
JPanel tableOptionsPanel = new JPanel();
|
JPanel tableOptionsPanel = new JPanel();
|
||||||
JLabel autoResizeModeLabel = new JLabel();
|
JLabel autoResizeModeLabel = new JLabel();
|
||||||
autoResizeModeField = new JComboBox<>();
|
autoResizeModeField = new JComboBox<>();
|
||||||
@@ -754,10 +761,11 @@ public class FlatComponents2Test
|
|||||||
treeOptionsPanel.setLayout(new MigLayout(
|
treeOptionsPanel.setLayout(new MigLayout(
|
||||||
"hidemode 3",
|
"hidemode 3",
|
||||||
// columns
|
// columns
|
||||||
"[fill]",
|
"[left]",
|
||||||
// rows
|
// rows
|
||||||
"[]" +
|
"[]" +
|
||||||
"[]0" +
|
"[]0" +
|
||||||
|
"[]0" +
|
||||||
"[]"));
|
"[]"));
|
||||||
|
|
||||||
//---- treeRendererLabel ----
|
//---- treeRendererLabel ----
|
||||||
@@ -786,6 +794,11 @@ public class FlatComponents2Test
|
|||||||
treePaintSelectionCheckBox.setSelected(true);
|
treePaintSelectionCheckBox.setSelected(true);
|
||||||
treePaintSelectionCheckBox.addActionListener(e -> treePaintSelectionChanged());
|
treePaintSelectionCheckBox.addActionListener(e -> treePaintSelectionChanged());
|
||||||
treeOptionsPanel.add(treePaintSelectionCheckBox, "cell 0 2");
|
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");
|
add(treeOptionsPanel, "cell 2 4");
|
||||||
|
|
||||||
@@ -905,6 +918,7 @@ public class FlatComponents2Test
|
|||||||
private JComboBox<String> treeRendererComboBox;
|
private JComboBox<String> treeRendererComboBox;
|
||||||
private JCheckBox treeWideSelectionCheckBox;
|
private JCheckBox treeWideSelectionCheckBox;
|
||||||
private JCheckBox treePaintSelectionCheckBox;
|
private JCheckBox treePaintSelectionCheckBox;
|
||||||
|
private JCheckBox treeEditableCheckBox;
|
||||||
private JComboBox<String> autoResizeModeField;
|
private JComboBox<String> autoResizeModeField;
|
||||||
private JComboBox<String> sortIconPositionComboBox;
|
private JComboBox<String> sortIconPositionComboBox;
|
||||||
private JCheckBox showHorizontalLinesCheckBox;
|
private JCheckBox showHorizontalLinesCheckBox;
|
||||||
|
|||||||
@@ -317,8 +317,8 @@ new FormModel {
|
|||||||
} )
|
} )
|
||||||
add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) {
|
add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) {
|
||||||
"$layoutConstraints": "hidemode 3"
|
"$layoutConstraints": "hidemode 3"
|
||||||
"$columnConstraints": "[fill]"
|
"$columnConstraints": "[left]"
|
||||||
"$rowConstraints": "[][]0[]"
|
"$rowConstraints": "[][]0[]0[]"
|
||||||
} ) {
|
} ) {
|
||||||
name: "treeOptionsPanel"
|
name: "treeOptionsPanel"
|
||||||
"border": new javax.swing.border.TitledBorder( "JTree Control" )
|
"border": new javax.swing.border.TitledBorder( "JTree Control" )
|
||||||
@@ -367,6 +367,16 @@ new FormModel {
|
|||||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||||
"value": "cell 0 2"
|
"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 ) {
|
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||||
"value": "cell 2 4"
|
"value": "cell 2 4"
|
||||||
} )
|
} )
|
||||||
|
|||||||
Reference in New Issue
Block a user