From d6a9ba641b4b1edf151cf53ec0b2865e1f404e95 Mon Sep 17 00:00:00 2001 From: Yvan Date: Tue, 27 Oct 2020 15:31:29 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-41503=20=E3=80=90JDK11=E3=80=91=E8=AE=BE?= =?UTF-8?q?=E8=AE=A1=E5=99=A8=E5=90=AF=E5=8A=A8=E9=A1=B5=E9=9D=A2=E5=9B=BE?= =?UTF-8?q?=E6=A0=87=E4=B8=8D=E6=B8=85=E6=99=B0=20=E3=80=90=E9=97=AE?= =?UTF-8?q?=E9=A2=98=E5=8E=9F=E5=9B=A0=E3=80=91Windows=E7=8E=AF=E5=A2=83?= =?UTF-8?q?=E4=B8=8B=EF=BC=8Cjdk11=E7=9A=84=E7=BC=A9=E6=94=BE=E4=BC=9A?= =?UTF-8?q?=E9=80=A0=E6=88=90=E7=BB=98=E5=88=B6=E5=90=AF=E5=8A=A8=E5=9B=BE?= =?UTF-8?q?=E7=89=87=E6=A8=A1=E7=B3=8A=20=E3=80=90=E6=94=B9=E5=8A=A8?= =?UTF-8?q?=E6=80=9D=E8=B7=AF=E3=80=91=E4=BD=BF=E7=94=A82=E5=80=8D?= =?UTF-8?q?=E5=9B=BE=EF=BC=8C=E7=84=B6=E5=90=8E=E7=94=A81=E5=80=8D?= =?UTF-8?q?=E5=9B=BE=E7=9A=84=E5=B0=BA=E5=AF=B8=E7=BB=98=E5=88=B6=E5=9B=BE?= =?UTF-8?q?=E7=89=87=EF=BC=8C=E5=86=8D=E7=BB=8F=E8=BF=87jdk11=E7=9A=84?= =?UTF-8?q?=E7=BC=A9=E6=94=BE=E4=B9=8B=E5=90=8E=E6=98=BE=E7=A4=BA=E6=95=88?= =?UTF-8?q?=E6=9E=9C=E4=BC=9A=E5=A5=BD=E4=B8=80=E4=BA=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/start/common/SplashPane.java | 3 + .../start/common/SplashPane4WinAndJDK11.java | 58 +++++++++++++++++++ .../com/fr/start/common/SplashWindow.java | 8 ++- 3 files changed, 68 insertions(+), 1 deletion(-) create mode 100644 designer-realize/src/main/java/com/fr/start/common/SplashPane4WinAndJDK11.java diff --git a/designer-realize/src/main/java/com/fr/start/common/SplashPane.java b/designer-realize/src/main/java/com/fr/start/common/SplashPane.java index 726bdaba44..49a957a21c 100644 --- a/designer-realize/src/main/java/com/fr/start/common/SplashPane.java +++ b/designer-realize/src/main/java/com/fr/start/common/SplashPane.java @@ -125,4 +125,7 @@ public class SplashPane extends JPanel { repaint(MODULE_INFO_X, THANK_INFO_Y - FONT_SIZE, MODULE_INFO_WIDTH, MODULE_INFO_HEIGHT); } + protected void paintJComponent(Graphics g) { + super.paintComponent(g); + } } diff --git a/designer-realize/src/main/java/com/fr/start/common/SplashPane4WinAndJDK11.java b/designer-realize/src/main/java/com/fr/start/common/SplashPane4WinAndJDK11.java new file mode 100644 index 0000000000..dae1808844 --- /dev/null +++ b/designer-realize/src/main/java/com/fr/start/common/SplashPane4WinAndJDK11.java @@ -0,0 +1,58 @@ +package com.fr.start.common; + +import com.bulenkov.iconloader.IconLoader; +import com.fr.base.BaseUtils; +import com.fr.design.locale.impl.SplashMark; +import com.fr.general.locale.LocaleCenter; + +import javax.swing.Icon; +import java.awt.Dimension; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.image.BufferedImage; +import java.io.File; + +/** + * @author Yvan + * @version 10.0 + * Created by Yvan on 2020/10/27 + */ +public class SplashPane4WinAndJDK11 extends SplashPane{ + /** + * 启动画面图片路径 + */ + private String imagePath; + + public SplashPane4WinAndJDK11() { + this.imagePath = getSplashPath4WinAndJdk11(); + } + + private String getSplashPath4WinAndJdk11() { + String path = "/com/fr/design/images/splash_10@2x.png"; + String filePath = this.getClass().getResource("/").getPath(); + // 某些定制jar里面没有两倍图,判断一下,如果文件不存在,就返回一倍图的path + if (new File(filePath + path).exists()) { + return path; + } + return (String) LocaleCenter.getMark(SplashMark.class).getValue(); + } + + @Override + protected void paintComponent(Graphics g) { + super.paintJComponent(g); + BufferedImage image = BaseUtils.readImage(imagePath); + Graphics2D newG = (Graphics2D)g.create(0, 0, image.getWidth(), image.getHeight()); + newG.scale(0.5D, 0.5D); + newG.drawImage(image, 0, 0, null); + newG.scale(1.0D, 1.0D); + newG.dispose(); + paintShowText((Graphics2D) g); + g.dispose(); + } + + @Override + Dimension getSplashDimension() { + Icon icon = IconLoader.getIcon(imagePath); + return new Dimension(icon.getIconWidth() / 2, icon.getIconHeight() / 2); + } +} diff --git a/designer-realize/src/main/java/com/fr/start/common/SplashWindow.java b/designer-realize/src/main/java/com/fr/start/common/SplashWindow.java index aa375c1dca..75ee988582 100644 --- a/designer-realize/src/main/java/com/fr/start/common/SplashWindow.java +++ b/designer-realize/src/main/java/com/fr/start/common/SplashWindow.java @@ -1,6 +1,7 @@ package com.fr.start.common; import com.fr.design.fun.OemProcessor; +import com.fr.design.jdk.JdkVersion; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.general.IOUtils; import com.fr.log.FineLoggerFactory; @@ -31,7 +32,12 @@ public class SplashWindow extends JFrame { initTitleIcon(); //slash pane - this.splash = new SplashPane(); + // 如果是Windows + JDK版本大于等于9时,一倍图启动会很模糊,这边使用两倍图 + if (OperatingSystem.isWindows() && JdkVersion.GE_9.support()) { + this.splash = new SplashPane4WinAndJDK11(); + } else { + this.splash = new SplashPane(); + } splash.setBackground(null); this.setContentPane(splash);