|
|
@ -3,6 +3,7 @@ |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
package com.fr.start; |
|
|
|
package com.fr.start; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import com.bulenkov.iconloader.IconLoader; |
|
|
|
import com.fr.base.BaseUtils; |
|
|
|
import com.fr.base.BaseUtils; |
|
|
|
import com.fr.base.FRContext; |
|
|
|
import com.fr.base.FRContext; |
|
|
|
import com.fr.base.GraphHelper; |
|
|
|
import com.fr.base.GraphHelper; |
|
|
@ -10,8 +11,6 @@ import com.fr.design.mainframe.bbs.BBSConstants; |
|
|
|
import com.fr.general.GeneralContext; |
|
|
|
import com.fr.general.GeneralContext; |
|
|
|
import com.fr.general.Inter; |
|
|
|
import com.fr.general.Inter; |
|
|
|
import com.fr.general.ModuleContext; |
|
|
|
import com.fr.general.ModuleContext; |
|
|
|
import com.fr.stable.Constants; |
|
|
|
|
|
|
|
import com.fr.stable.CoreGraphHelper; |
|
|
|
|
|
|
|
import com.fr.stable.StableUtils; |
|
|
|
import com.fr.stable.StableUtils; |
|
|
|
import com.fr.stable.StringUtils; |
|
|
|
import com.fr.stable.StringUtils; |
|
|
|
import com.fr.stable.module.ModuleAdapter; |
|
|
|
import com.fr.stable.module.ModuleAdapter; |
|
|
@ -19,9 +18,6 @@ import com.fr.stable.module.ModuleListener; |
|
|
|
|
|
|
|
|
|
|
|
import javax.swing.*; |
|
|
|
import javax.swing.*; |
|
|
|
import java.awt.*; |
|
|
|
import java.awt.*; |
|
|
|
import java.awt.font.FontRenderContext; |
|
|
|
|
|
|
|
import java.awt.font.LineMetrics; |
|
|
|
|
|
|
|
import java.awt.image.BufferedImage; |
|
|
|
|
|
|
|
import java.util.Locale; |
|
|
|
import java.util.Locale; |
|
|
|
import java.util.Random; |
|
|
|
import java.util.Random; |
|
|
|
import java.util.TimerTask; |
|
|
|
import java.util.TimerTask; |
|
|
@ -36,12 +32,12 @@ public class ReportSplashPane extends SplashPane { |
|
|
|
private static final String SPLASH_MAC_CN = "splash_chinese_mac.png"; |
|
|
|
private static final String SPLASH_MAC_CN = "splash_chinese_mac.png"; |
|
|
|
private static final String SPLASH_MAC_EN = "splash_english_mac.png"; |
|
|
|
private static final String SPLASH_MAC_EN = "splash_english_mac.png"; |
|
|
|
|
|
|
|
|
|
|
|
private static final Color MODULE_COLOR = new Color(230, 230, 230); |
|
|
|
private static final Color MODULE_COLOR = new Color(255, 255, 255); |
|
|
|
private static final int MODULE_INFO_X = 25; |
|
|
|
private static final int MODULE_INFO_X = 54; |
|
|
|
private static final int MODULE_INFO_Y = 270; |
|
|
|
private static final int MODULE_INFO_Y = 340; |
|
|
|
|
|
|
|
|
|
|
|
private static final Color THANK_COLOR = new Color(72, 216, 249); |
|
|
|
private static final Color THANK_COLOR = new Color(255, 255, 255, (int) (0.4 * 255 + 0.5)); |
|
|
|
private static final int THANK_INFO_X = 460; |
|
|
|
private static final int THANK_INFO_Y = 382; |
|
|
|
|
|
|
|
|
|
|
|
private static final String GUEST = getRandomUser(); |
|
|
|
private static final String GUEST = getRandomUser(); |
|
|
|
|
|
|
|
|
|
|
@ -80,52 +76,34 @@ public class ReportSplashPane extends SplashPane { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
protected void paintComponent(Graphics g) { |
|
|
|
protected void paintComponent(Graphics g) { |
|
|
|
super.paintComponent(g); |
|
|
|
Icon icon = IconLoader.getIcon(StableUtils.pathJoin(OEM_PATH, getImageName())); |
|
|
|
Graphics2D g2d = (Graphics2D) g; |
|
|
|
icon.paintIcon(null, g, 0, 0); |
|
|
|
Image image = getSplashImage(); |
|
|
|
paintShowText((Graphics2D) g); |
|
|
|
ImageIcon imageIcon = new ImageIcon(image); |
|
|
|
|
|
|
|
GraphHelper.paintImage(g2d, imageIcon.getIconWidth(), imageIcon.getIconHeight(), image, Constants.IMAGE_DEFAULT, Constants.NULL, Constants.CENTER, -1, -1); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void setShowText(String text) { |
|
|
|
public void setShowText(String text) { |
|
|
|
this.showText = text; |
|
|
|
this.showText = text; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public BufferedImage getSplashImage() { |
|
|
|
public Image getSplashImage() { |
|
|
|
// p:初始化splashImage,其中画了字符.
|
|
|
|
Icon icon = IconLoader.getIcon(StableUtils.pathJoin(OEM_PATH, getImageName())); |
|
|
|
Image image = createSplashBackground(); |
|
|
|
return ((ImageIcon) IconLoader.getIconSnapshot(icon)).getImage(); |
|
|
|
BufferedImage splashBuffedImage = CoreGraphHelper.toBufferedImage(image); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Graphics2D splashG2d = splashBuffedImage.createGraphics(); |
|
|
|
|
|
|
|
splashG2d.setPaint(new Color(230, 230, 230)); |
|
|
|
|
|
|
|
splashG2d.setFont(new Font("Dialog", Font.PLAIN, 11)); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//绘制需要显示的文本
|
|
|
|
|
|
|
|
paintShowText(splashG2d); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return splashBuffedImage; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void paintShowText(Graphics2D splashG2d) { |
|
|
|
private void paintShowText(Graphics2D splashG2d) { |
|
|
|
FontRenderContext fontRenderContext = splashG2d.getFontRenderContext(); |
|
|
|
GraphHelper.applyRenderingHints(splashG2d); |
|
|
|
LineMetrics fm = splashG2d.getFont().getLineMetrics("", |
|
|
|
|
|
|
|
fontRenderContext); |
|
|
|
|
|
|
|
double leading = fm.getLeading(); |
|
|
|
|
|
|
|
double ascent = fm.getAscent(); |
|
|
|
|
|
|
|
double height = fm.getHeight(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
splashG2d.setPaint(MODULE_COLOR); |
|
|
|
splashG2d.setPaint(MODULE_COLOR); |
|
|
|
splashG2d.setFont(new Font("Dialog", Font.PLAIN, 12)); |
|
|
|
splashG2d.setFont(new Font("Dialog", Font.PLAIN, 12)); |
|
|
|
|
|
|
|
|
|
|
|
//加载模块信息
|
|
|
|
//加载模块信息
|
|
|
|
double y = MODULE_INFO_Y + height + leading + ascent; |
|
|
|
GraphHelper.drawString(splashG2d, showText, MODULE_INFO_X, MODULE_INFO_Y); |
|
|
|
GraphHelper.drawString(splashG2d, showText, MODULE_INFO_X, y); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//每次随机感谢一位论坛用户
|
|
|
|
//每次随机感谢一位论坛用户
|
|
|
|
if (shouldShowThanks()) { |
|
|
|
if (shouldShowThanks()) { |
|
|
|
splashG2d.setPaint(THANK_COLOR); |
|
|
|
splashG2d.setPaint(THANK_COLOR); |
|
|
|
String content = Inter.getLocText("FR-Designer_Thanks-To") + GUEST; |
|
|
|
String content = Inter.getLocText("FR-Designer_Thanks-To") + GUEST; |
|
|
|
GraphHelper.drawString(splashG2d, content, THANK_INFO_X, y); |
|
|
|
GraphHelper.drawString(splashG2d, content, MODULE_INFO_X, THANK_INFO_Y); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|