Browse Source
* commit '246c2fd151de42d6ba7e0f542af795bffc88800c': CHART-16440 甘特图项目轴面板 修改魔法值问题 更新 REPORT-41503 修改代码错误 REPORT-41503 【JDK11】设计器启动页面图标不清晰 【问题原因】Windows环境下,jdk11的缩放会造成绘制启动图片模糊 【改动思路】使用2倍图,然后用1倍图的尺寸绘制图片,再经过jdk11的缩放之后显示效果会好一些bugfix/10.0
superman
4 years ago
5 changed files with 172 additions and 14 deletions
@ -0,0 +1,57 @@
|
||||
package com.fr.van.chart.gantt.designer.style.axis; |
||||
|
||||
import com.fr.base.BaseUtils; |
||||
import com.fr.design.gui.ibutton.UIButtonGroup; |
||||
import com.fr.design.gui.ilable.UILabel; |
||||
import com.fr.design.i18n.Toolkit; |
||||
import com.fr.plugin.chart.gantt.attr.GanttAxisStyleAttr; |
||||
import com.fr.plugin.chart.gantt.attr.GanttAxisStyleAttrWithPosition; |
||||
import com.fr.stable.Constants; |
||||
|
||||
import javax.swing.Icon; |
||||
import java.awt.Component; |
||||
|
||||
/** |
||||
* @author Bjorn |
||||
* @version 10.0 |
||||
* Created by Bjorn on 2020-10-27 |
||||
*/ |
||||
public class GanttAxisStylePaneWithPosition extends GanttAxisStylePane { |
||||
|
||||
private UIButtonGroup<Integer> alignmentPane; |
||||
|
||||
protected void initComponents() { |
||||
super.initComponents(); |
||||
Icon[] alignmentIconArray = {BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_left_normal.png"), |
||||
BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_center_normal.png"), |
||||
BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_right_normal.png")}; |
||||
Integer[] alignment = new Integer[]{Constants.LEFT, Constants.CENTER, Constants.RIGHT}; |
||||
alignmentPane = new UIButtonGroup<>(alignmentIconArray, alignment); |
||||
} |
||||
|
||||
protected Component[][] getUsedComponents() { |
||||
return new Component[][]{ |
||||
new Component[]{getTextAttrPane(), null}, |
||||
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Color")), getColorSelectBox4button()}, |
||||
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Report_Alpha")), getTransparent()}, |
||||
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Form_BorderLayout_Constraints")), alignmentPane} |
||||
}; |
||||
} |
||||
|
||||
public void populateBean(GanttAxisStyleAttrWithPosition contentAttr) { |
||||
super.populateBean(contentAttr); |
||||
alignmentPane.setSelectedItem(contentAttr.getPosition()); |
||||
} |
||||
|
||||
public void updateBean(GanttAxisStyleAttrWithPosition contentAttr) { |
||||
super.updateBean(contentAttr); |
||||
contentAttr.setPosition(alignmentPane.getSelectedItem()); |
||||
} |
||||
|
||||
@Override |
||||
public GanttAxisStyleAttr updateBean() { |
||||
GanttAxisStyleAttrWithPosition styleAttr = new GanttAxisStyleAttrWithPosition(); |
||||
updateBean(styleAttr); |
||||
return styleAttr; |
||||
} |
||||
} |
@ -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()); |
||||
} |
||||
} |
Loading…
Reference in new issue