From 9239e90287e2f7b42127d6d9a100a3244755c96e Mon Sep 17 00:00:00 2001 From: Starryi Date: Wed, 22 Sep 2021 17:09:37 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-59351=20=E3=80=90=E4=B8=BB=E9=A2=98?= =?UTF-8?q?=E5=88=87=E6=8D=A2=E3=80=91=E5=9B=BD=E9=99=85=E5=8C=96=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【问题原因】 视觉变动,修改主题编辑面板中控件的尺寸和布局 【改动思路】 同上 --- .../theme/TemplateThemeEditorPane.java | 21 ++++++------- .../theme/edit/ComponentStyleEditPane.java | 30 +++++++++---------- .../mainframe/theme/edit/ui/LabelUtils.java | 19 ++++++++++++ .../mainframe/theme/edit/ui/TabbedPane.java | 1 - 4 files changed, 42 insertions(+), 29 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeEditorPane.java b/designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeEditorPane.java index c10eef79e5..a5301e9565 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeEditorPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeEditorPane.java @@ -42,13 +42,10 @@ import java.util.List; * Created by Starryi on 2021/8/13 */ public abstract class TemplateThemeEditorPane extends JPanel { - public static final int TITLE_BORDER_FONT = 12; public static final int LEFT_TITLE_PANE_HEIGHT = 539; public static final int RIGHT_PANE_WIDTH = 362; public static final int RIGHT_PANE_HEIGHT = LEFT_TITLE_PANE_HEIGHT; - public static final int COLOR_SCHEME_TITLE_PANE_WIDTH = 298; - public static final int COLOR_SCHEME_TITLE_PANE_HEIGHT = 174 + TITLE_BORDER_FONT / 2; protected AutoCheckThemeNameTextField nameTextField; private UILabel nameErrorLabel; @@ -122,12 +119,14 @@ public abstract class TemplateThemeEditorPane extends J colorListPane = new ColorListPane(); colorListExtendedPane = new ColorListExtendedPane(); - JPanel extendedContainer = FRGUIPaneFactory.createBorderLayout_S_Pane(); colorListExtendedPane.setBackground(null); colorListExtendedPane.setOpaque(false); - extendedContainer.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); - extendedContainer.setBackground(Color.WHITE); - extendedContainer.add(colorListExtendedPane); + JPanel extendedBackgroundContainer = FRGUIPaneFactory.createBorderLayout_S_Pane(); + extendedBackgroundContainer.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); + extendedBackgroundContainer.setBackground(Color.WHITE); + extendedBackgroundContainer.add(colorListExtendedPane, BorderLayout.WEST); + JPanel extendedContainer = FRGUIPaneFactory.createBorderLayout_S_Pane(); + extendedContainer.add(extendedBackgroundContainer, BorderLayout.WEST); double p = TableLayout.PREFERRED; double[] rowSize = new double[]{p, p, p}; @@ -151,12 +150,11 @@ public abstract class TemplateThemeEditorPane extends J content.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); JPanel borderContainer = new JPanel(new BorderLayout()); - borderContainer.setPreferredSize(new Dimension(COLOR_SCHEME_TITLE_PANE_WIDTH, COLOR_SCHEME_TITLE_PANE_HEIGHT)); borderContainer.setBorder(BorderUtils.createTitleBorder(Toolkit.i18nText("Fine-Design_Basic_Template_Theme_Edit_Pane_Color_Scheme_Title"))); borderContainer.add(content); JPanel container = new JPanel(new BorderLayout()); - container.add(borderContainer, BorderLayout.WEST); + container.add(borderContainer, BorderLayout.CENTER); colorListPane.addColorChangeListener(new ChangeListener() { @Override @@ -193,18 +191,17 @@ public abstract class TemplateThemeEditorPane extends J uiTabbedPane = new UITabbedPane(); uiTabbedPane.setBorder(BorderFactory.createEmptyBorder(10, 5, 10, 1)); - container.add(uiTabbedPane, BorderLayout.NORTH); + container.add(uiTabbedPane, BorderLayout.CENTER); return container; } public void addCustomEditorPane(String title, final Component component) { - component.setPreferredSize(new Dimension(317, 239)); AbstractAttrNoScrollPane settingPane = new NoBorderAbstractAttrNoScrollPane() { @Override protected JPanel createContentPane() { JPanel contentPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); - contentPane.add(component, BorderLayout.NORTH); + contentPane.add(component, BorderLayout.CENTER); return contentPane; } }; diff --git a/designer-base/src/main/java/com/fr/design/mainframe/theme/edit/ComponentStyleEditPane.java b/designer-base/src/main/java/com/fr/design/mainframe/theme/edit/ComponentStyleEditPane.java index 53e216b0d6..de62a195d4 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/theme/edit/ComponentStyleEditPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/theme/edit/ComponentStyleEditPane.java @@ -2,8 +2,7 @@ package com.fr.design.mainframe.theme.edit; import com.fr.base.theme.settings.ThemedComponentStyle; import com.fr.design.designer.IntervalConstants; -import com.fr.design.dialog.AttrScrollPane; -import com.fr.design.gui.ilable.UILabel; +import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.gui.style.ComponentBodyStylePane; import com.fr.design.gui.style.ComponentIntegralStylePane; import com.fr.design.gui.style.ComponentTitleStylePane; @@ -18,10 +17,9 @@ import com.fr.general.act.BorderPacker; import javax.swing.BorderFactory; import javax.swing.JComponent; import javax.swing.JPanel; -import javax.swing.JScrollPane; +import javax.swing.JTextArea; import java.awt.BorderLayout; import java.awt.Color; -import java.awt.Dimension; /** * @author Starryi @@ -50,7 +48,8 @@ public class ComponentStyleEditPane extends JPanel { }, new JComponent[] { createTabContainer(componentTitleStylePane), createTabContainer(componentBodyStylePane), createTabContainer(componentIntegralStylePane) } ); - add(content, BorderLayout.NORTH); + content.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); + add(content, BorderLayout.CENTER); } public void populateBean(ThemedComponentStyle style) { @@ -115,21 +114,20 @@ public class ComponentStyleEditPane extends JPanel { } private JComponent createTabContainer(final JPanel component) { - JPanel container = FRGUIPaneFactory.createBorderLayout_S_Pane(); - container.setPreferredSize(new Dimension(container.getPreferredSize().width, 220)); + JPanel content = FRGUIPaneFactory.createBorderLayout_S_Pane(); JPanel tipLabelPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); tipLabelPane.setBorder(BorderFactory.createEmptyBorder(3, 0, 0, 0)); - UILabel tipLabel = LabelUtils.createLabel(Toolkit.i18nText("Fine-Design_Basic_Template_Theme_Edit_Pane_Component_Style_Tip"), new Color(153, 153, 153)); + JTextArea tipLabel = LabelUtils.createAutoWrapLabel(Toolkit.i18nText("Fine-Design_Basic_Template_Theme_Edit_Pane_Component_Style_Tip"), new Color(153, 153, 153)); tipLabelPane.add(tipLabel); - container.add(tipLabelPane, BorderLayout.NORTH); - - container.add(new AttrScrollPane() { - @Override - protected JPanel createContentPane() { - return component; - } - }, BorderLayout.CENTER); + content.add(tipLabelPane, BorderLayout.NORTH); + content.add(component, BorderLayout.CENTER); + + UIScrollPane scrollPane = new UIScrollPane(content); + scrollPane.setBorder(BorderFactory.createEmptyBorder()); + + JPanel container = FRGUIPaneFactory.createBorderLayout_S_Pane(); + container.add(scrollPane, BorderLayout.CENTER); return container; diff --git a/designer-base/src/main/java/com/fr/design/mainframe/theme/edit/ui/LabelUtils.java b/designer-base/src/main/java/com/fr/design/mainframe/theme/edit/ui/LabelUtils.java index 2b099ed306..13769cfc64 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/theme/edit/ui/LabelUtils.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/theme/edit/ui/LabelUtils.java @@ -3,6 +3,9 @@ package com.fr.design.mainframe.theme.edit.ui; import com.fr.design.gui.ilable.UILabel; import com.fr.general.FRFont; +import javax.swing.BorderFactory; +import javax.swing.JTextArea; +import javax.swing.plaf.basic.BasicTextAreaUI; import java.awt.Color; import java.awt.Font; @@ -26,4 +29,20 @@ public class LabelUtils { uiLabel.setFont(newFont); return uiLabel; } + + public static JTextArea createAutoWrapLabel(String title, Color color) { + JTextArea tipLabel = new JTextArea(); + tipLabel.setUI(new BasicTextAreaUI()); + tipLabel.setForeground(color); + Font newFont = FRFont.getInstance(tipLabel.getFont().getFontName(), Font.PLAIN, 12); + tipLabel.setFont(newFont); + tipLabel.setBorder(BorderFactory.createEmptyBorder()); + tipLabel.setEnabled(false); + tipLabel.setText(title); + tipLabel.setLineWrap(true); + tipLabel.setWrapStyleWord(true); + tipLabel.setOpaque(false); + tipLabel.setBackground(null); + return tipLabel; + } } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/theme/edit/ui/TabbedPane.java b/designer-base/src/main/java/com/fr/design/mainframe/theme/edit/ui/TabbedPane.java index 3f4667e111..c1c8371674 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/theme/edit/ui/TabbedPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/theme/edit/ui/TabbedPane.java @@ -25,7 +25,6 @@ public class TabbedPane extends JPanel { public TabbedPane(String[] names, JComponent[] panes) { setLayout(FRGUIPaneFactory.createBorderLayout()); - setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); for (JComponent pane :panes) { pane.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));