diff --git a/designer-base/src/main/java/com/fine/theme/utils/FineComponentsFactory.java b/designer-base/src/main/java/com/fine/theme/utils/FineComponentsFactory.java index 2e8e71d393..880b2dfd16 100644 --- a/designer-base/src/main/java/com/fine/theme/utils/FineComponentsFactory.java +++ b/designer-base/src/main/java/com/fine/theme/utils/FineComponentsFactory.java @@ -3,9 +3,11 @@ package com.fine.theme.utils; import com.fine.theme.icon.LazyIcon; import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.fr.data.core.FormatField; +import com.fr.design.border.FineBorderFactory; import com.fr.design.border.UIRoundedBorder; import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.gui.ilable.UILabel; +import com.fr.design.gui.itextarea.UITextArea; import com.fr.design.i18n.Toolkit; import com.fr.stable.Constants; @@ -13,10 +15,12 @@ import javax.swing.BorderFactory; import javax.swing.Icon; import javax.swing.JButton; import javax.swing.JPanel; +import javax.swing.JScrollPane; import javax.swing.border.Border; import javax.swing.border.TitledBorder; import java.awt.Color; +import java.awt.Dimension; import static com.fine.swing.ui.layout.Layouts.cell; import static com.fine.swing.ui.layout.Layouts.flex; @@ -92,4 +96,18 @@ public class FineComponentsFactory { return sampleLabel; } + /** + * 创建一个固定高度、可上下滚动的文本域面板 + * @param textArea 文本域 + * @param height 高度 + * @return 滚动面板 + */ + public static JScrollPane createFixHeightTextArea(UITextArea textArea, int height) { + JScrollPane scrollPane = new JScrollPane(textArea); + scrollPane.setPreferredSize(new Dimension(scrollPane.getPreferredSize().width, height)); + scrollPane.setBorder(FineBorderFactory.createWrappedRoundBorder()); + textArea.setBorder(null); + return scrollPane; + } + } diff --git a/designer-chart/src/main/java/com/fr/van/chart/map/designer/type/TileLayerPane.java b/designer-chart/src/main/java/com/fr/van/chart/map/designer/type/TileLayerPane.java index 25e4316df0..c0e340b4cc 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/map/designer/type/TileLayerPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/map/designer/type/TileLayerPane.java @@ -1,5 +1,6 @@ package com.fr.van.chart.map.designer.type; +import com.fine.theme.utils.FineComponentsFactory; import com.fine.theme.utils.FineLayoutBuilder; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.itextarea.UITextArea; @@ -9,6 +10,8 @@ import javax.swing.JPanel; import java.awt.BorderLayout; import java.awt.Component; +import static com.fine.theme.utils.FineUIScale.scale; + /** * @author Bjorn * @version 10.0 @@ -24,8 +27,10 @@ public class TileLayerPane extends JPanel { customTileLayer = new UITextArea(); attribution = new UITextArea(); Component[][] comps = new Component[][]{ - new Component[]{new UILabel("url"), customTileLayer}, - new Component[]{new UILabel("Attribution"), attribution} + new Component[]{new UILabel("url"), + FineComponentsFactory.createFixHeightTextArea(customTileLayer, scale(36))}, + new Component[]{new UILabel("Attribution"), + FineComponentsFactory.createFixHeightTextArea(attribution, scale(36))} }; JPanel panel = FineLayoutBuilder.compatibleTableLayout(10, comps, new double[]{1.2, 3}); diff --git a/designer-chart/src/main/java/com/fr/van/chart/map/designer/type/WMSLayerPane.java b/designer-chart/src/main/java/com/fr/van/chart/map/designer/type/WMSLayerPane.java index f6394c0ff9..9d44b4c2e0 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/map/designer/type/WMSLayerPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/map/designer/type/WMSLayerPane.java @@ -1,6 +1,7 @@ package com.fr.van.chart.map.designer.type; +import com.fine.theme.utils.FineComponentsFactory; import com.fine.theme.utils.FineLayoutBuilder; import com.fr.decision.webservice.v10.map.MapEditService; import com.fr.design.dialog.FineJOptionPane; @@ -28,6 +29,8 @@ import java.awt.event.ActionListener; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; +import static com.fine.theme.utils.FineUIScale.scale; + /** * @author Bjorn * @version 10.0 @@ -61,9 +64,11 @@ public class WMSLayerPane extends JPanel implements UIObserver { connectButton = new UIButton(Toolkit.i18nText("Fine-Design_Chart_Connect_WMP")); Component[][] comps = new Component[][]{ - new Component[]{new UILabel("url"), wmsUrl, null, connectButton} + new Component[]{new UILabel("url"), + FineComponentsFactory.createFixHeightTextArea(wmsUrl, scale(36)), + null, connectButton} }; - JPanel northPane = FineLayoutBuilder.compatibleTableLayout(10, comps, new double[]{1.2, 1.4, 0.2, 1.4}); + JPanel northPane = FineLayoutBuilder.compatibleTableLayout(10, comps, new double[]{1.2, 1.8, 0.2, 1.0}); wmsLayerPane = new JPanel(new BorderLayout()); resetWMSLayerPane(new ArrayList<>());