diff --git a/designer-base/src/main/java/com/fr/design/actions/file/RenameAction.java b/designer-base/src/main/java/com/fr/design/actions/file/RenameAction.java index ac19f107b6..9ef710c787 100644 --- a/designer-base/src/main/java/com/fr/design/actions/file/RenameAction.java +++ b/designer-base/src/main/java/com/fr/design/actions/file/RenameAction.java @@ -186,7 +186,7 @@ public class RenameAction extends UpdateAction { warnLabel.setPreferredSize(FineUIScale.scale(new Dimension(300, 50))); warnLabel.setHorizontalAlignment(SwingConstants.LEFT); warnLabel.setVerticalAlignment(SwingConstants.TOP); - warnLabel.setForeground(Color.RED); + FineUIStyle.setStyle(warnLabel, FineUIStyle.LABEL_WARNING_TIP); warnLabel.setVisible(false); JPanel midPanel = new JPanel(new BorderLayout()); diff --git a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java index ce282861e4..cbda592149 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java @@ -1,8 +1,10 @@ package com.fr.design.mainframe; import com.fanruan.repository.TemplateRepository; +import com.fine.swing.ui.layout.Layouts; import com.fine.theme.icon.LazyIcon; import com.fine.theme.utils.FineLayoutBuilder; +import com.fine.theme.utils.FineUIScale; import com.fine.theme.utils.FineUIStyle; import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.fr.base.BaseUtils; @@ -641,11 +643,7 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt this.setModal(true); // 输入框前提示 - UILabel newNameLabel = new UILabel(Toolkit.i18nText( - "Fine-Design_Basic_Enter_New_Folder_Name") - ); - newNameLabel.setHorizontalAlignment(SwingConstants.RIGHT); - newNameLabel.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 10)); + UILabel newNameLabel = new UILabel(Toolkit.i18nText("Fine-Design_Basic_Enter_New_Folder_Name")); // 文件名输入框 nameField = new UITextField(); @@ -667,12 +665,9 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt } }); nameField.selectAll(); - nameField.setPreferredSize(new Dimension(180, 20)); - JPanel topPanel = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 5)); - topPanel.setBorder(BorderFactory.createEmptyBorder(15, 15, 0, 15)); - topPanel.add(newNameLabel); - topPanel.add(nameField); + JPanel topPanel = Layouts.row(10, Layouts.cell(newNameLabel), Layouts.cell(nameField).weight(1)).getComponent(); + topPanel.setBorder(new ScaledEmptyBorder(15, 10, 0, 10)); // 增加enter以及esc快捷键的支持 nameField.addKeyListener(new KeyAdapter() { @@ -689,15 +684,14 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt }); // 重名提示 warnLabel = new UILabel(); - warnLabel.setPreferredSize(new Dimension(300, 50)); warnLabel.setHorizontalAlignment(SwingConstants.LEFT); warnLabel.setVerticalAlignment(SwingConstants.TOP); - warnLabel.setForeground(Color.RED); warnLabel.setVisible(false); + FineUIStyle.setStyle(warnLabel, FineUIStyle.LABEL_WARNING_TIP); JPanel midPanel = new JPanel(new BorderLayout()); - midPanel.setBorder(BorderFactory.createEmptyBorder(0, 15, 0, 15)); - midPanel.add(warnLabel, BorderLayout.WEST); + midPanel.setBorder(new ScaledEmptyBorder(0, 10, 0, 10)); + midPanel.add(Layouts.column(Layouts.flex(), Layouts.cell(warnLabel), Layouts.flex()).getComponent()); // 确认按钮 confirmButton = new UIButton(Toolkit.i18nText("Fine-Design_Basic_Confirm")); @@ -719,10 +713,8 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt } }); - JPanel bottomPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT, 10, 0)); - bottomPanel.setBorder(BorderFactory.createEmptyBorder(10, 15, 10, 10)); - bottomPanel.add(confirmButton); - bottomPanel.add(cancelButton); + JPanel bottomPanel = Layouts.row(10, Layouts.flex(), Layouts.cell(confirmButton), Layouts.cell(cancelButton)).getComponent(); + bottomPanel.setBorder(new ScaledEmptyBorder(10, 10, 10, 10)); this.add( TableLayoutHelper.createTableLayoutPane( @@ -731,13 +723,12 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt new Component[]{midPanel}, new Component[]{bottomPanel} }, - new double[]{TableLayout.FILL, TableLayout.PREFERRED, TableLayout.PREFERRED}, + new double[]{TableLayout.PREFERRED, TableLayout.FILL, TableLayout.PREFERRED}, new double[]{TableLayout.FILL} ), BorderLayout.CENTER); - - this.setSize(380, 200); + this.setSize(FineUIScale.createScaleDimension(380, 200)); this.setTitle(Toolkit.i18nText("Fine-Design_Basic_Mkdir")); this.setResizable(false); this.setAlwaysOnTop(true);