Browse Source

Merge pull request #2740 in DESIGN/design from final/10.0 to persist/10.0

* commit '587386f883bd95cc9a9f6236f46f3ff4fc0db852':
  REPORT-38688 设计器在双屏下拖动会有卡屏的现象
  REPORT-38688 设计器在双屏下拖动会有卡屏的现象
  修改魔法值问题
  更新
  REPORT-41503 修改代码错误
  REPORT-41503 【JDK11】设计器启动页面图标不清晰 【问题原因】Windows环境下,jdk11的缩放会造成绘制启动图片模糊 【改动思路】使用2倍图,然后用1倍图的尺寸绘制图片,再经过jdk11的缩放之后显示效果会好一些
persist/10.0
superman 4 years ago
parent
commit
fbb33890b0
  1. 4
      designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java
  2. 75
      designer-realize/src/main/java/com/fr/start/common/SplashPane4WinAndJDK11.java
  3. 8
      designer-realize/src/main/java/com/fr/start/common/SplashWindow.java

4
designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java

@ -548,10 +548,10 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
contentHeight = layeredPane.getHeight();
contentWidth = layeredPane.getWidth();
layeredPane.remove(basePane);
// 这个地方remove和add都是一个对象 完全没有必要remove再add 改变了窗口大小重新设置下 然后有repaint即可
basePane.setBounds(0, 0, contentWidth, contentHeight);
layeredPane.add(basePane);
layeredPane.repaint();
layeredPane.revalidate();
}
/**

75
designer-realize/src/main/java/com/fr/start/common/SplashPane4WinAndJDK11.java

@ -0,0 +1,75 @@
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.IOUtils;
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;
/**
* @author Yvan
* @version 10.0
* Created by Yvan on 2020/10/27
*/
public class SplashPane4WinAndJDK11 extends SplashPane{
/**
* 启动画面图片路径
*/
private final String imagePath;
/**
* 启动画面图片是否使用了两倍图
*/
private boolean isDouble = false;
private static final String IMAGE_SPLASH = "splash_10.png";
private static final String IMAGE_SPLASH_DOUBLE = "splash_10@2x.png";
public SplashPane4WinAndJDK11() {
this.imagePath = getSplashPath4WinAndJdk11();
}
private String getSplashPath4WinAndJdk11() {
String path = (String) LocaleCenter.getMark(SplashMark.class).getValue();
if (path.contains(IMAGE_SPLASH)) {
// 为图片加上"@2x"
String pathOfDouble = path.replace(IMAGE_SPLASH, IMAGE_SPLASH_DOUBLE);
// 某些定制jar里面没有两倍图,判断一下,如果文件不存在,就返回一倍图的path
if (IOUtils.readResource(pathOfDouble) != null) {
this.isDouble = true;
return pathOfDouble;
}
}
return path;
}
@Override
protected void paintComponent(Graphics g) {
if (!isDouble) {
super.paintComponent(g);
return;
}
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 isDouble ? new Dimension(icon.getIconWidth() / 2, icon.getIconHeight() / 2) :
new Dimension(icon.getIconWidth(), icon.getIconHeight());
}
}

8
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);

Loading…
Cancel
Save