Added a per-tree wide selection setting

This commit is contained in:
Ingo Kegel
2021-01-19 17:46:41 +01:00
parent c6fec0a131
commit 60f3428da7
3 changed files with 64 additions and 13 deletions

View File

@@ -0,0 +1,28 @@
package com.formdev.flatlaf.extras.components;
import javax.swing.*;
import static com.formdev.flatlaf.FlatClientProperties.TREE_WIDE_SELECTION;
import static com.formdev.flatlaf.FlatClientProperties.clientPropertyBoolean;
/**
* Subclass of {@link JTree} that provides easy access to FlatLaf specific client properties.
*
*/
public class FlatTree
extends JTree
implements FlatComponentExtension
{
/**
* Returns if the tree shows a wide selection
*/
public boolean isWideSelection() {
return clientPropertyBoolean( this, TREE_WIDE_SELECTION, UIManager.getBoolean( "Tree.wideSelection" ));
}
/**
* Sets if the tree shows a wide selection
*/
public void setWideSelection(boolean wideSelection) {
putClientProperty( TREE_WIDE_SELECTION, wideSelection);
}
}