From d1321ea0815c4b4a4c4b672b38ac363728852cf6 Mon Sep 17 00:00:00 2001 From: hades Date: Tue, 4 Jan 2022 15:56:57 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-65369=20=E8=AE=BE=E8=AE=A1=E5=99=A8?= =?UTF-8?q?=E5=86=85=E5=AF=B9macOS12=E7=9A=84=E5=A4=84=E7=90=86-=E6=8C=89?= =?UTF-8?q?=E9=92=AE=E5=9B=BE=E6=A0=87=E8=AE=BE=E7=BD=AE-=E5=9C=A8?= =?UTF-8?q?=E7=82=B9=E5=87=BB=20=E9=80=89=E6=8B=A9=E5=9B=BE=E7=89=87?= =?UTF-8?q?=E6=97=B6=E5=9B=9E=E5=88=B0=E4=BA=86=E7=88=B6=E5=BC=B9=E7=AA=97?= =?UTF-8?q?=E7=95=8C=E9=9D=A2=EF=BC=8C=E6=B2=A1=E6=9C=89=E5=AE=9E=E6=97=B6?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E5=87=BA=E6=9D=A5=EF=BC=8C=E8=80=8C=E9=9C=80?= =?UTF-8?q?=E8=A6=81=E5=86=8D=E6=AC=A1=E5=8D=95=E6=9C=BA=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8=E7=95=8C=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/design/web/CustomIconPane.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) 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 96b5840208..564b09d467 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 @@ -40,6 +40,7 @@ import java.awt.FlowLayout; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Image; +import java.awt.Window; import javax.swing.ButtonGroup; import javax.swing.ImageIcon; import javax.swing.JComponent; @@ -425,7 +426,7 @@ public class CustomIconPane extends BasicPane { browseButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { - onBrowseButtonClicked(); + onBrowseButtonClicked(SwingUtilities.getWindowAncestor(EditIconDialog.this)); } }); @@ -460,11 +461,11 @@ public class CustomIconPane extends BasicPane { this.add(centerPane, BorderLayout.CENTER); } - private void onBrowseButtonClicked() { + private void onBrowseButtonClicked(Window parent) { // carl:不知道是否只要png格式,反正导出时全部都转成png了 FileChooserProvider fileChooserProvider = FileChooserFactory.createFileChooser(FileChooserArgs.newBuilder(). setFilter("Icon Image File", "*.jpg", "*.jpeg", "*.png", "*.gif").build()); - if (JFileChooser.APPROVE_OPTION == fileChooserProvider.showDialog(DesignerContext.getDesignerFrame())) { + if (JFileChooser.APPROVE_OPTION == fileChooserProvider.showDialog(parent)) { String path = fileChooserProvider.getSelectedFile().getAbsolutePath(); // 图片存储有最大值48*48限制,没有超过最大值时,按原图大小存储,超过最大值后,压缩至最大值存储 Image image = BaseUtils.readImage(path);