|
|
@ -2,13 +2,12 @@ package com.fr.design.gui.itree.filetree; |
|
|
|
|
|
|
|
|
|
|
|
import com.fine.theme.utils.FineUIScale; |
|
|
|
import com.fine.theme.utils.FineUIScale; |
|
|
|
import com.fine.theme.utils.FineUIUtils; |
|
|
|
import com.fine.theme.utils.FineUIUtils; |
|
|
|
import com.formdev.flatlaf.ui.FlatUIUtils; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import javax.swing.JTree; |
|
|
|
import javax.swing.JTree; |
|
|
|
import javax.swing.UIManager; |
|
|
|
|
|
|
|
import javax.swing.BorderFactory; |
|
|
|
import javax.swing.BorderFactory; |
|
|
|
import javax.swing.tree.DefaultTreeCellRenderer; |
|
|
|
import javax.swing.tree.DefaultTreeCellRenderer; |
|
|
|
import java.awt.*; |
|
|
|
import java.awt.Component; |
|
|
|
|
|
|
|
import java.awt.Insets; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Tree子节点的渲染器 |
|
|
|
* Tree子节点的渲染器 |
|
|
@ -21,10 +20,12 @@ public class FineTreeCellRender extends DefaultTreeCellRenderer { |
|
|
|
|
|
|
|
|
|
|
|
private static final long serialVersionUID = 1L; |
|
|
|
private static final long serialVersionUID = 1L; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static final Insets DEFAULT_TREE_RENDER_MARGIN = new Insets(2, 0, 2, 0); |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public Component getTreeCellRendererComponent(JTree tree, Object value, boolean sel, boolean expanded, boolean leaf, int row, boolean hasFocus) { |
|
|
|
public Component getTreeCellRendererComponent(JTree tree, Object value, boolean sel, boolean expanded, boolean leaf, int row, boolean hasFocus) { |
|
|
|
super.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, hasFocus); |
|
|
|
super.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, hasFocus); |
|
|
|
Insets margins = FineUIUtils.getUIInsets("Tree.rendererMargins", new Insets(2, 0 ,2, 0)); |
|
|
|
Insets margins = FineUIUtils.getUIInsets("Tree.rendererMargins", DEFAULT_TREE_RENDER_MARGIN); |
|
|
|
margins = FineUIScale.scale(margins); |
|
|
|
margins = FineUIScale.scale(margins); |
|
|
|
this.setBorder(BorderFactory.createEmptyBorder(margins.top, margins.left, |
|
|
|
this.setBorder(BorderFactory.createEmptyBorder(margins.top, margins.left, |
|
|
|
margins.bottom, margins.right)); |
|
|
|
margins.bottom, margins.right)); |
|
|
|