Browse Source

REPORT-107972 按钮组、颜色选择框、树适配dpi切换

newui
Levy.Xie-解安森 1 year ago
parent
commit
cbc073dab0
  1. 2
      designer-base/src/main/java/com/fr/design/gui/icombobox/UIComboBox.java
  2. 9
      designer-base/src/main/java/com/fr/design/gui/itree/filetree/FineTreeCellRender.java
  3. 2
      designer-base/src/main/resources/com/fine/theme/light/ui/laf/FineLaf.properties

2
designer-base/src/main/java/com/fr/design/gui/icombobox/UIComboBox.java

@ -162,7 +162,7 @@ public class UIComboBox extends JComboBox implements UIObserver, GlobalNameObser
int renderFix = FineUIScale.scale(5);
int comboHeight = FineUIUtils.getAndScaleInt("ComboBox.comboHeight", 24);
//renderFix的原因在于:render里,每一个项前面了空了一格,要多几像素
return new Dimension(super.getPreferredSize().width + renderFix, comboHeight);
return new Dimension(FineUIScale.scale(super.getPreferredSize().width) + renderFix, comboHeight);
}
public void refreshBoxItems(List list) {

9
designer-base/src/main/java/com/fr/design/gui/itree/filetree/FineTreeCellRender.java

@ -2,13 +2,12 @@ package com.fr.design.gui.itree.filetree;
import com.fine.theme.utils.FineUIScale;
import com.fine.theme.utils.FineUIUtils;
import com.formdev.flatlaf.ui.FlatUIUtils;
import javax.swing.JTree;
import javax.swing.UIManager;
import javax.swing.BorderFactory;
import javax.swing.tree.DefaultTreeCellRenderer;
import java.awt.*;
import java.awt.Component;
import java.awt.Insets;
/**
* Tree子节点的渲染器
@ -21,10 +20,12 @@ public class FineTreeCellRender extends DefaultTreeCellRenderer {
private static final long serialVersionUID = 1L;
private static final Insets DEFAULT_TREE_RENDER_MARGIN = new Insets(2, 0, 2, 0);
@Override
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);
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);
this.setBorder(BorderFactory.createEmptyBorder(margins.top, margins.left,
margins.bottom, margins.right));

2
designer-base/src/main/resources/com/fine/theme/light/ui/laf/FineLaf.properties

@ -44,4 +44,6 @@ ToolTipUI=com.fine.theme.light.ui.FineTooltipUI
TreeUI=com.fine.theme.light.ui.UIFlatTreeUI
ViewportUI=com.formdev.flatlaf.ui.FlatViewportUI
HeadGroupUI=com.fine.theme.light.ui.FineHeadGroupUI
ButtonGroupUI= com.fine.theme.light.ui.FineButtonGroupUI
SelectBoxUI= com.fine.theme.light.ui.FineSelectBoxUI

Loading…
Cancel
Save