From 9311b2eeecc1f210cde3aa60f8f34e0dc9ec97c2 Mon Sep 17 00:00:00 2001 From: "Leo.Qin" Date: Thu, 11 Jan 2024 14:31:20 +0800 Subject: [PATCH] =?UTF-8?q?=20REPORT-107973=20=E4=BF=AE=E6=94=B9=20?= =?UTF-8?q?=E4=B8=9C=E5=8C=BA=E6=8C=89=E9=92=AE=E8=BE=B9=E6=A1=86=E3=80=81?= =?UTF-8?q?=E6=BB=91=E5=9D=97=E9=AB=98=E5=BA=A6=E3=80=81=E4=B8=BB=E9=A2=98?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E6=8C=89=E9=92=AE=E5=AE=BD=E5=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mainframe/EastRegionContainerPane.java | 3 +-- .../fr/design/mainframe/JFormSliderPane.java | 21 +++++++++++++------ .../com/fr/design/mainframe/JTemplate.java | 11 +--------- 3 files changed, 17 insertions(+), 18 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java b/designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java index f060bf0fff..1875c9fcd0 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java @@ -5,7 +5,6 @@ import com.fine.theme.light.ui.RectangleButtonUI; import com.fine.theme.utils.FineUIScale; import com.fine.theme.utils.FineUIUtils; import com.formdev.flatlaf.FlatDarkLaf; -import com.formdev.flatlaf.ui.FlatLineBorder; import com.fr.base.FRContext; import com.fr.base.vcs.DesignerMode; import com.fr.design.DesignerEnvManager; @@ -425,7 +424,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer { } leftPane.add(item.getButton()); } - leftPane.setBorder(new FlatLineBorder(new Insets(0,1,0,1), UIManager.getColor("East.border"))); + leftPane.setBorder(BorderFactory.createMatteBorder(0, 1, 0, 1, UIManager.getColor("East.border"))); replaceLeftPane(leftPane); } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/JFormSliderPane.java b/designer-base/src/main/java/com/fr/design/mainframe/JFormSliderPane.java index 78da7a6e63..cef7222edf 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/JFormSliderPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/JFormSliderPane.java @@ -1,7 +1,6 @@ package com.fr.design.mainframe; import com.fine.theme.icon.LazyIcon; -import com.fine.theme.utils.FineUIScale; import com.fine.theme.utils.FineUIStyle; import com.fine.theme.utils.FineUIUtils; import com.formdev.flatlaf.ui.FlatUIUtils; @@ -12,7 +11,6 @@ import com.fr.design.gui.itextfield.UINumberField; import javax.swing.BorderFactory; import javax.swing.JPanel; -import javax.swing.UIManager; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import java.awt.BorderLayout; @@ -69,7 +67,7 @@ public class JFormSliderPane extends JPanel { initSlider(); initDownUpButton(); initShowValField(); - JPanel panel = new JPanel(new FlowLayout(FlowLayout.CENTER, 0, 0)); + JPanel panel = new JPanel(new FlowLayout(FlowLayout.CENTER, 0, 2)); panel.add(downButton); panel.add(slider); panel.add(upButton); @@ -123,10 +121,15 @@ public class JFormSliderPane extends JPanel { } private void initShowValField() { - showValField = new UINumberField(); + showValField = new UINumberField() { + @Override + public Dimension getPreferredSize() { + int width = FineUIUtils.getAndScaleInt("FormSliderPane.showValueWidth", 40); + int height = FineUIUtils.getAndScaleInt("FormSliderPane.showValueHeight", 20); + return new Dimension(width, height); + } + }; showValField.setValue(showValue); - Dimension dimension = new Dimension(UIManager.getInt("FormSliderPane.showValueWidth"), UIManager.getInt("FormSliderPane.showValueHeight")); - showValField.setPreferredSize(FineUIScale.scale(dimension)); showValField.addKeyListener(new KeyListener() { @Override public void keyTyped(KeyEvent e) { @@ -293,5 +296,11 @@ public class JFormSliderPane extends JPanel { public void addValueChangeListener(ChangeListener changeListener){ this.slider.addChangeListener(changeListener); } + + @Override + public Dimension getPreferredSize() { + Dimension size = super.getPreferredSize(); + return new Dimension(size.width, FineUIUtils.getAndScaleInt("Component.defaultHeight", 24)); + } } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java b/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java index ae24c9ca1a..039ddbd782 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java @@ -115,8 +115,6 @@ import javax.swing.JOptionPane; import javax.swing.SwingConstants; import javax.swing.undo.UndoManager; import java.awt.BorderLayout; -import java.awt.Dimension; -import java.awt.FontMetrics; import java.io.ByteArrayOutputStream; import java.nio.file.Paths; import java.util.Arrays; @@ -1610,14 +1608,7 @@ public abstract class JTemplate> } protected UIButton createTemplateThemeButton() { - UIButton button = new UIButton(new LazyIcon("template_theme")) { - @Override - public Dimension getPreferredSize() { - FontMetrics metrics = getFontMetrics(getFont()); - int width = Math.min(metrics.stringWidth(getText()) + PREDEFINED_ICON_WIDTH, 100); - return new Dimension(width, 20); - } - }; + UIButton button = new UIButton(new LazyIcon("template_theme")); button.setToolTipText(getTemplateTheme().getName()); button.setText(getTemplateTheme().getName()); button.setName(getTemplateTheme().getName());