From 623edcaf9176af13c1abdd01f68a1d8fd991cba5 Mon Sep 17 00:00:00 2001 From: "Henry.Wang" Date: Mon, 2 Aug 2021 19:21:17 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-55072=20=E8=AE=BE=E8=AE=A1=E5=99=A8?= =?UTF-8?q?=E5=86=85=E6=96=87=E4=BB=B6=E9=80=89=E6=8B=A9=E5=99=A8=E6=9B=BF?= =?UTF-8?q?=E6=8D=A2=E4=B8=BA=E5=8E=9F=E7=94=9F=E7=9A=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/actions/file/PreferencePane.java | 2 +- .../java/com/fr/design/web/CustomIconPane.java | 16 +++++++++------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java b/designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java index eecff994bb..a41f962954 100644 --- a/designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java +++ b/designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java @@ -262,7 +262,7 @@ public class PreferencePane extends BasicPane { embedServerPanel.add(embedServerLazyStartupCheckBox); advancePane.add(embedServerPanel); - JPanel imageCompressPanel = FRGUIPaneFactory.createVerticalTitledBorderPane(i18nText("Fine-Design_Template_Preview_Performance=")); + JPanel imageCompressPanel = FRGUIPaneFactory.createVerticalTitledBorderPane(i18nText("Fine-Design_Template_Preview_Performance")); imageCompressPanelCheckBox = new UICheckBox(i18nText("Fine-Design_Image_Compress")); imageCompressPanel.add(imageCompressPanelCheckBox); advancePane.add(imageCompressPanel); diff --git a/designer-base/src/main/java/com/fr/design/web/CustomIconPane.java b/designer-base/src/main/java/com/fr/design/web/CustomIconPane.java index ef66fc039a..9e03dcc9dc 100644 --- a/designer-base/src/main/java/com/fr/design/web/CustomIconPane.java +++ b/designer-base/src/main/java/com/fr/design/web/CustomIconPane.java @@ -10,6 +10,8 @@ import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.dialog.FineJOptionPane; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.icontainer.UIScrollPane; +import com.fr.design.gui.ifilechooser.FileChooserProvider; +import com.fr.design.gui.ifilechooser.JavaFxNativeFileChooser; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.iscrollbar.UIScrollBar; import com.fr.design.gui.itextarea.DescriptionTextArea; @@ -28,6 +30,7 @@ import com.fr.stable.ListMap; import com.fr.stable.StringUtils; import com.fr.transaction.Configurations; import com.fr.transaction.WorkerFacade; +import javafx.stage.FileChooser; import javax.swing.*; import javax.swing.event.ChangeEvent; @@ -108,7 +111,7 @@ public class CustomIconPane extends BasicPane { } - protected String createDescriptionText(){ + protected String createDescriptionText() { return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Custom_Icon_Message1"); } @@ -447,13 +450,12 @@ public class CustomIconPane extends BasicPane { } private void onBrowseButtonClicked() { - JFileChooser jf = new JFileChooser(); // carl:不知道是否只要png格式,反正导出时全部都转成png了 - FileNameExtensionFilter fileFilter = new FileNameExtensionFilter("Icon Image File", "jpg", "jpeg", "png", "gif"); - jf.setFileFilter(fileFilter); - - if (JFileChooser.APPROVE_OPTION == jf.showOpenDialog(DesignerContext.getDesignerFrame())) { - String path = jf.getSelectedFile().getAbsolutePath(); + FileChooserProvider fileChooserProvider = new JavaFxNativeFileChooser.Builder(). + filter("Icon Image File", "*.jpg", "*.jpeg", "*.png", "*.gif"). + build(); + if (JFileChooser.APPROVE_OPTION == fileChooserProvider.showDialog(DesignerContext.getDesignerFrame())) { + String path = fileChooserProvider.getSelectedFile().getAbsolutePath(); // 图片存储有最大值48*48限制,没有超过最大值时,按原图大小存储,超过最大值后,压缩至最大值存储 Image image = BaseUtils.readImage(path); iconImage = ImageUtils.scale((BufferedImage) image, Math.min(image.getWidth(null), IconManager.MAXSTORAGE_ICONWIDTH), Math.min(image.getHeight(null), IconManager.MAXSTORAGE_ICONHEIGHT), true, Image.SCALE_SMOOTH);